Entity color can be set and read as numeric index values ranging from 0 to 256, or by instances of AcCmColor. The correct color index can be obtained from an instance of AcCmColor using the AcCmColor::getColorIndex() member function.
Color indexes 1 through 7 are used for standard colors, as shown in the following table
Colors 1 to 7 |
|
---|---|
Color Number |
Color Name |
1 |
Red |
2 |
Yellow |
3 |
Green |
4 |
Cyan |
5 |
Blue |
6 |
Magenta |
7 |
White or Black |
:
Colors 8 through 255 are defined by the display device.
The following index values have special meanings:
- 0
-
Specifies BYBLOCK. Entities inherit the color of the current block reference that points to the block table record that the entity resides in, or black/white if the entity resides directly in the model space or paper space block table record.
- 256
-
Specifies BYLAYER. Entities assume the color of the entity's associated layer.
- 257
-
No color. Only present from the time an entity is first instantiated until its color is set to a value between 0 and 256, or the entity is added to the database and assumes the database's current color index.
If a color value is specified for an entity, the current database default color value is ignored. Use the following functions to set and query an entity color:
- setColor
- setColorIndex
- color
- colorIndex