getcolorindex
(getcolorindex [color_no] [flag])
The getcolorindex function displays the Colors dialog box allowing the user to select a color.
The function displays the Colors dialog box with all 255 colors that are possible in a drawing, and, in addition, with two buttons to set the logical colors ByLayer and ByBlock.
Arguments
The getcolorindex function accepts two optional arguments that influence the appearance of the dialog box.
The color_no argument provides the setting of a default color for the dialog box.
If the color_no argument is not specified, the default color is black (color no. 7).
When color_no is 0, the default is ByBlock. When color_no is 256, the default is ByLayer.
The optional flag argument can only be either nil or T (true). When the parameter T is passed to the function, the dialog box disables the Match to Layer (ByLayer) and the Match to Block (ByBlock) buttons.
Return Value
The function returns the color number the user selected in the dialog box or nil if the user clicked the Cancel button.
Note: The current drawing color can be retrieved with the (setq x (entget (car (entsel)))) function applied on the CECOLOR system variable.
The first nine color numbers have the following meanings:
Number |
Color |
1 |
Red |
2 |
Yellow |
3 |
Green |
4 |
Cyan |
5 |
Blue |
6 |
Magenta |
7 |
Black |
8 |
Dark Gray |
9 |
Light Gray |
(getcolorindex)
displays the Colors dialog box with standard settings.
(getcolorindex 2)
displays dialog box with color 2 (yellow) set as the default.
(getcolorindex T)
displays dialog box with the buttons with the buttons Match to Layer (ByLayer) and Match to Block (ByBlock) disabled.
(getcolorindex 5 T)
displays dialog box with color 5 (blue) set as the default and with the buttons Match to Layer (ByLayer) and Match to Block (ByBlock) disabled.
acad_colordlg, getvar, setvar