After reading the comments, I've put something together (since I've had the same need once) :
; Grrr
; Select objects by their truecolour (doesn't work for entity whos color is an "index color" or "Bylayer/Byblock")
(defun C:test ( / SysVarLst *error* e ex tc SS )
(setvar 'errno 0)(sssetfirst nil nil)
(defun *error* ( msg )
(mapcar '(lambda ( n v / ) (setvar n v)) (mapcar 'car SysVarLst) (mapcar 'cadr SysVarLst))
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ (strcat "\nError: " msg))
)
(princ)
)
(setq SysVarLst
(mapcar '(lambda ( a b / ) (list a (getvar a) b))
(list "CLIPROMPTLINES" "CMDECHO" "PDMODE") ; PDMODE, because sometimes is hard to (entsel) a point with PDMODE of 0 value
(list 3 0 3) ; the new intended values
)
)
(mapcar '(lambda ( n v / ) (setvar n v)) (mapcar 'car SysVarLst) (mapcar 'caddr SysVarLst))
(while
(not
(and
(setq e (car (entsel "\nSelect source entity to filter by its TrueColour: ")))
(setq ex (entget e))
(member 420 (mapcar 'car ex))
(setq tc (cdr (assoc 420 ex)))
)
)
(cond
((and e (not tc)) (princ "\nThis entity doesn't have TrueColour!"))
((or (member (getvar 'errno) '(7 52)) (null e)) (princ "\nMissed, try again!"))
)
)
;; Convert TrueColor into a list of RGB
;; by Gopinath Taget from adndevblog.typepad.com:
(defun TrueColorToRGB (tcol)
(list
(lsh tcol -16) ; R
(lsh (lsh tcol 16) -24) ; G
(lsh (lsh tcol 24) -24) ; B
)
); defun
(princ (strcat "\nSelect objects to filter by \"" (vl-princ-to-string (TrueColorToRGB tc)) "\" TrueColour! "))
(if (setq SS (ssget "_:L" (list (cons 420 tc) (cons 410 (getvar 'ctab)))))
(progn
(princ (strcat "\nSelected " (itoa (sslength SS)) " objects!"))
(sssetfirst nil SS)
)
)
(mapcar '(lambda ( n v / ) (setvar n v)) (mapcar 'car SysVarLst) (mapcar 'cadr SysVarLst))
(princ)
);| defun |; (vl-load-com) (princ)