aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/faces.el26
1 files changed, 0 insertions, 26 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index b5e9fdca08e..c9cc611a97a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1818,32 +1818,6 @@ with the color they represent as background color."
1818 "black" 1818 "black"
1819 "white"))) 1819 "white")))
1820 1820
1821(defun defined-colors-with-face-attributes (&optional frame)
1822 "Return a list of colors supported for a particular frame.
1823See `defined-colors' for arguments and return value. In contrast
1824to `define-colors' the elements of the returned list are color
1825strings with text properties, that make the color names render
1826with the color they represent as background color."
1827 (mapcar
1828 (lambda (color-name)
1829 (let ((foreground (readable-foreground-color color-name))
1830 (color (copy-sequence color-name)))
1831 (propertize color 'face (list :foreground foreground
1832 :background color))))
1833 (defined-colors frame)))
1834
1835(defun readable-foreground-color (color)
1836 "Return a readable foreground color for background COLOR."
1837 (let* ((rgb (color-values color))
1838 (max (apply #'max rgb))
1839 (black (car (color-values "black")))
1840 (white (car (color-values "white"))))
1841 ;; Select black or white depending on which one is less similar to
1842 ;; the brightest component.
1843 (if (> (abs (- max black)) (abs (- max white)))
1844 "black"
1845 "white")))
1846
1847(declare-function xw-color-defined-p "xfns.c" (color &optional frame)) 1821(declare-function xw-color-defined-p "xfns.c" (color &optional frame))
1848 1822
1849(defun color-defined-p (color &optional frame) 1823(defun color-defined-p (color &optional frame)