Function: list-colors-duplicates
list-colors-duplicates is a byte-compiled function defined in
facemenu.el.gz.
Signature
(list-colors-duplicates &optional LIST)
Documentation
Return a list of colors with grouped duplicate colors.
If a color has no duplicates, then the element of the returned list
has the form (COLOR-NAME). The element of the returned list with
duplicate colors has the form (COLOR-NAME DUPLICATE-COLOR-NAME ...).
This function uses the predicate facemenu-color-equal to compare
color names. If the optional argument LIST is non-nil, it should
be a list of colors to display. Otherwise, this function uses
a list of colors that the current display can handle.
Source Code
;; Defined in /usr/src/emacs/lisp/facemenu.el.gz
(defun list-colors-duplicates (&optional list)
"Return a list of colors with grouped duplicate colors.
If a color has no duplicates, then the element of the returned list
has the form (COLOR-NAME). The element of the returned list with
duplicate colors has the form (COLOR-NAME DUPLICATE-COLOR-NAME ...).
This function uses the predicate `facemenu-color-equal' to compare
color names. If the optional argument LIST is non-nil, it should
be a list of colors to display. Otherwise, this function uses
a list of colors that the current display can handle."
(let* ((list (mapcar 'list (or list (defined-colors))))
(l list))
(while (cdr l)
(if (and (facemenu-color-equal (car (car l)) (car (car (cdr l))))
;; On MS-Windows, there are logical colors that might have
;; the same value but different names and meanings. For
;; example, `SystemMenuText' (the color w32 uses for the
;; text in menu entries) and `SystemWindowText' (the default
;; color w32 uses for the text in windows and dialogs) may
;; be the same display color and be adjacent in the list.
;; These system colors all have names prefixed with "System",
;; which is hardcoded in w32fns.c (SYSTEM_COLOR_PREFIX).
;; This makes them different to any other color. Bug#9722
(not (and (eq system-type 'windows-nt)
(string-match-p "^System" (car (car l))))))
(progn
(setcdr (car l) (cons (car (car (cdr l))) (cdr (car l))))
(setcdr l (cdr (cdr l))))
(setq l (cdr l))))
list))