Prompts for colors at the command line

(acad_truecolorcli color [allowbylayer] [alternatePrompt])



A dotted pair that describes the default color. The first element of the dotted pair must be one of the color-related DXF group codes (62, 420, or 430); for example, (62 . ColorIndex), (420 . TrueColor), or (430 . "colorbook$colorname").


Omitting the allowbylayer argument or setting it to a non-nil value enables entering bylayer or byblock to set the color. If set to nil, an error results if bylayer or byblock is entered.


An optional prompt string. If this string is omitted, the default value is “New color”.

Return Values

When the operation is successful, the function returns a list of one or more dotted pairs (depending on the tab on which the color is selected) describing the color selected. The last dotted pair in the list indicates the color selected. The function returns nil if the user cancels the dialog box.

Color book color

If the last item in the returned list is a 430 pair, then the specified color originates from a color book. This returned list will also contain a 420 pair that describes the corresponding true color and a 62 pair that describes the closest matching color index value.

True color

If the returned list contains a 420 pair as the last item, then a true color was specified (as “Red,Green,Blue”). The list will also contain a 62 pair that indicates the closest matching color index. No 430 pair will be present.

Color index

If the last item in the list is a 62 pair, then a colorindex was chosen. No other dotted pairs will be present in the returned list.


Prompt for a color selection at the command line with a purple color index default selection and alternative text for the command prompt:

Command: (acad_truecolorcli '(62 . 215) 1 "Pick a color")

New Color [Truecolor/COlorbook] <215>:

((62 . 215))

Prompt for a color selection at the command line with a yellow color index default selection, then set the color by layer:

Command: (acad_truecolorcli '(62 . 2))

New Color [Truecolor/COlorbook] <2 (yellow)>: bylayer

((62 . 256))