(acad_truecolordlg color-number [flag])
Display the Color dialog box with the Index Color, True Color, and Color Books tabs.
This function displays the Color dialog box with the Index Color, True Color, and Color Books tabs. This function returns the color that the user selects from the dialog box or nil when the user clicks the Cancel button.
The color-number argument lets you provide a default color that is selected when the dialog box opens.
- Type 62 long value = A color index in the range 0 - 256. The Color Index tab is current. Note that when defcol is 0, the default is BYBLOCK; when defcol is 256, the default is BYLAYER.
- Type 420 long value = An RGB COLORREF value of the color. The True Color tab is current.
- Type 430 string value = A color$colorbookname separated by a '$'. The Color Books tab is current.
When flag is nil, the dialog box disables the BYBLOCK and BYLAYER buttons.
The function returns the color that was selected by the user in list form containing dotted pairs:
- Color index Only one dotted pair is present: a 62 group code type, which is the selected index color.
- True color Two dotted pairs are present. The last dotted pair is a 420 group code type, which is the selected true color, and the first dotted pair is the closest matching index color.
- Color book color Three dotted pairs are present. The last dotted pair is a 430 group code type, which is the selected color book color. The second dotted pair is the corresponding true color and the first dotted pair is the closest matching index color.
Examples
The following example opens the dialog box with the color red as the default.
(setq selectedColor (acad_truecolordlg '(62 . 1)))
When the user selects a different color, that value will be assigned to the variable selectedColor:
(setq selectedColor (acad_truecolordlg '(62 . 1))
((62 . 180))
To get the value of the return:
(cdr (car selectedColor))
180
NOTE The first eight color numbers have the following meanings:
Number | Color |
---|---|
1 | Red |
2 | Yellow |
3 | Green |
4 | Cyan (light blue) |
5 | Blue |
6 | Magenta (pink) |
7 | Black or White |
8 | Dark Gray |
9 | Light Gray |
The following example opens the dialog box with a color book color as the default.
(setq selectedColor(acad_truecolordlg '(430 . "Orange$Color book sample")))
((62 . 222) (420 . 8388800) (430 . "Deeppink$Color book sample"))
When the user selects a different color, that value will be assigned to the variable selectedColor:
(setq colorPair (assoc 430 selectedColor))
(430 . "Deeppink$Color book sample")
To get the value of the return:
(cdr colorPair)
"Deeppink$Color book sample"
Tell me about...
Programming Overview of LISP (LISt Processing) Language