Returns the RGB color value for a given AutoCAD color index.
Parameters
index: number
The AutoCAD color index value (0-255).
Returns number
The RGB color value as a 24-bit integer.
Example
// Get the RGB value for color index 1 (red) constredColor = AcCmColorUtil.getAcadColor(1); // returns 16711680 (0xFF0000)
Example
// Get special inheritance colors constbyBlock = AcCmColorUtil.getAcadColor(0); // "ByBlock" color constbyLayer = AcCmColorUtil.getAcadColor(256); // "ByLayer" color
StaticgetColorByName
getColorByName(name:string):number
Returns the RGB color value for a given CSS color name.
Parameters
name: string
The CSS color name (e.g., "red", "blue", "aliceblue").
Returns number
The RGB color value as a 24-bit integer, or undefined if the name is not found.
Example
// Get the RGB value for a standard color name constredColor = AcCmColorUtil.getColorByName("red"); // returns 16711680 (0xFF0000) constblueColor = AcCmColorUtil.getColorByName("blue"); // returns 255 (0x0000FF)
Example
// Handle undefined for unknown color names constunknownColor = AcCmColorUtil.getColorByName("unknown"); // returns undefined
StaticgetNameByColor
getNameByColor(rgb:number):undefined|string
Finds the color name associated with a given RGB value.
Parameters
rgb: number
The RGB value to find a name for.
Returns undefined|string
The color name if found, undefined otherwise.
StaticgetNameByIndex
getNameByIndex(index:number):undefined|string
Finds the color name associated with a given color index.
Utility class for AutoCAD color operations.