Colors are integers until you start dealing with colorbook colors or truecolors. Then it gets a bit more complicated and you have to deal with truecolor objects. I have used the following to create a truecolor object from a textstring retrieved from a data file:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Routine: MakeTColor ;;;
;;; Purpose: Create a TrueColor object ;;;
;;; Arguments: Color - the layer color: ;;;
;;; If an integer, or a string that converts directly to an integer, then it's an ;;;
;;; ACI color If a string with a leading "T" and no embeded dollar sign ("$") ;;;
;;; then remainder of the string is an RGB treble (RRRGGGBBB) If a string with an ;;;
;;; embeded dollar sign then portion before the $ is the colorbook name, and the ;;;
;;; portion following the $ is the color name. If there is no corresponding ;;;
;;; colorbook found then an error is returned with the colorbook name. If the ;;;
;;; color argument is nil, then nil is returned. ;;;
;;; Returns: A truecolor object ("AutoCAD.AcCmColor") ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun MakeTColor(col / colorbook colorname tcolorobj temp)
(setq
tcolorobj (vla-getinterfaceobject
(vlax-get-acad-object)
(strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))
) ;_ end of vla-getinterfaceobject
col (if (= 'INT (type col))
(itoa col)
col
)
)
(cond
((null col) nil)
;;this is a colorbook color
((setq temp (vl-string-position (ascii "$") col))
(and
(setq colorbook (substr col 1 temp)
colorname (substr col (+ temp 2))
) ;setq`
(not (vl-catch-all-error-p
(vl-catch-all-apply
'vla-SetColorBookColor
(list tcolorobj colorbook colorname)
) ;_ end of vl-catch-all-apply
) ;_ end of vl-catch-all-error-p
) ;_ end of not
tcolorobj
) ;_ end of and
) ;end colorbook color
;;this is a truecolor
((= "T" (strcase (substr col 1 1)))
(vla-put-colormethod tcolorobj acColorMethodByRGB)
(vla-SetRGB
tcolorobj
;;(TrueColor-make
(atoi (substr col 2 3))
(atoi (substr col 5 3))
(atoi (substr col 8 3))
;;)
) ;_ end of vla-SetRGB
tcolorobj
) ;end of truecolor
;;It must be an ACI color
(T
(vla-put-colormethod tcolorobj acColorMethodByACI)
(vla-put-colorindex tcolorobj (atoi col))
tcolorobj
) ;end T
)
)
This truecolor object would then be applied to the layers truecolor property.