aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/faces.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index ab6c384c802..fa526c35061 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -55,6 +55,7 @@ This means to treat a terminal of type TYPE as if it were of type ALIAS."
55 :group 'terminals 55 :group 'terminals
56 :version "25.1") 56 :version "25.1")
57 57
58(declare-function display-graphic-p "frame" (&optional display))
58(declare-function xw-defined-colors "term/common-win" (&optional frame)) 59(declare-function xw-defined-colors "term/common-win" (&optional frame))
59 60
60(defvar help-xref-stack-item) 61(defvar help-xref-stack-item)
@@ -1239,7 +1240,7 @@ of a global face. Value is the new attribute value."
1239 ;; explicitly in VALID, using color approximation code 1240 ;; explicitly in VALID, using color approximation code
1240 ;; in tty-colors.el. 1241 ;; in tty-colors.el.
1241 (when (and (memq attribute '(:foreground :background)) 1242 (when (and (memq attribute '(:foreground :background))
1242 (not (memq (window-system frame) '(x w32 ns))) 1243 (not (display-graphic-p frame))
1243 (not (member new-value 1244 (not (member new-value
1244 '("unspecified" 1245 '("unspecified"
1245 "unspecified-fg" "unspecified-bg")))) 1246 "unspecified-fg" "unspecified-bg"))))
@@ -1833,7 +1834,7 @@ The argument FRAME specifies which frame to try.
1833The value may be different for frames on different display types. 1834The value may be different for frames on different display types.
1834If FRAME doesn't support colors, the value is nil. 1835If FRAME doesn't support colors, the value is nil.
1835If FRAME is nil, that stands for the selected frame." 1836If FRAME is nil, that stands for the selected frame."
1836 (if (memq (framep (or frame (selected-frame))) '(x w32 ns)) 1837 (if (display-graphic-p frame)
1837 (xw-defined-colors frame) 1838 (xw-defined-colors frame)
1838 (mapcar 'car (tty-color-alist frame)))) 1839 (mapcar 'car (tty-color-alist frame))))
1839(defalias 'x-defined-colors 'defined-colors) 1840(defalias 'x-defined-colors 'defined-colors)
@@ -1877,7 +1878,7 @@ or one of the strings \"unspecified-fg\" or \"unspecified-bg\".
1877 1878
1878If FRAME is omitted or nil, use the selected frame." 1879If FRAME is omitted or nil, use the selected frame."
1879 (unless (member color '(unspecified "unspecified-bg" "unspecified-fg")) 1880 (unless (member color '(unspecified "unspecified-bg" "unspecified-fg"))
1880 (if (member (framep (or frame (selected-frame))) '(x w32 ns)) 1881 (if (display-graphic-p frame)
1881 (xw-color-defined-p color frame) 1882 (xw-color-defined-p color frame)
1882 (numberp (tty-color-translate color frame))))) 1883 (numberp (tty-color-translate color frame)))))
1883(defalias 'x-color-defined-p 'color-defined-p) 1884(defalias 'x-color-defined-p 'color-defined-p)
@@ -1903,7 +1904,7 @@ return value is nil."
1903 (cond 1904 (cond
1904 ((member color '(unspecified "unspecified-fg" "unspecified-bg")) 1905 ((member color '(unspecified "unspecified-fg" "unspecified-bg"))
1905 nil) 1906 nil)
1906 ((memq (framep (or frame (selected-frame))) '(x w32 ns)) 1907 ((display-graphic-p frame)
1907 (xw-color-values color frame)) 1908 (xw-color-values color frame))
1908 (t 1909 (t
1909 (tty-color-values color frame)))) 1910 (tty-color-values color frame))))
@@ -1917,7 +1918,7 @@ return value is nil."
1917The optional argument DISPLAY specifies which display to ask about. 1918The optional argument DISPLAY specifies which display to ask about.
1918DISPLAY should be either a frame or a display name (a string). 1919DISPLAY should be either a frame or a display name (a string).
1919If omitted or nil, that stands for the selected frame's display." 1920If omitted or nil, that stands for the selected frame's display."
1920 (if (memq (framep-on-display display) '(x w32 ns)) 1921 (if (display-graphic-p display)
1921 (xw-display-color-p display) 1922 (xw-display-color-p display)
1922 (tty-display-color-p display))) 1923 (tty-display-color-p display)))
1923(defalias 'x-display-color-p 'display-color-p) 1924(defalias 'x-display-color-p 'display-color-p)
@@ -1928,12 +1929,9 @@ If omitted or nil, that stands for the selected frame's display."
1928 "Return non-nil if frames on DISPLAY can display shades of gray. 1929 "Return non-nil if frames on DISPLAY can display shades of gray.
1929DISPLAY should be either a frame or a display name (a string). 1930DISPLAY should be either a frame or a display name (a string).
1930If omitted or nil, that stands for the selected frame's display." 1931If omitted or nil, that stands for the selected frame's display."
1931 (let ((frame-type (framep-on-display display))) 1932 (if (display-graphic-p display)
1932 (cond 1933 (x-display-grayscale-p display)
1933 ((memq frame-type '(x w32 ns)) 1934 (> (tty-color-gray-shades display) 2)))
1934 (x-display-grayscale-p display))
1935 (t
1936 (> (tty-color-gray-shades display) 2)))))
1937 1935
1938(defun read-color (&optional prompt convert-to-RGB allow-empty-name msg) 1936(defun read-color (&optional prompt convert-to-RGB allow-empty-name msg)
1939 "Read a color name or RGB triplet. 1937 "Read a color name or RGB triplet.