diff options
author | Glenn Morris <rgm@gnu.org> | 2018-07-20 10:00:32 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-07-20 10:00:32 -0700 |
commit | 6ee00324619673b402dadb3c28e791b79527868f (patch) | |
tree | 57070a6bb9dcf0620107f113f67551fe622c7385 /lisp/term | |
parent | 144bcc0132e61cc932348312720d592764022844 (diff) | |
parent | 3e722980df9d4a705394c843a2a5e051e9c682b6 (diff) | |
download | emacs-6ee00324619673b402dadb3c28e791b79527868f.tar.gz |
Merge from origin/emacs-26
3e72298 Improve documentation of 'pcase-defmacro rx'
ba9b9bb Fix TTY colors breakage by 'clear-face-cache'
f56ad42 * admin/MAINTAINERS: Add files maintained by me (Michael Albi...
7a258fa Adapt shadowfile.el for Tramp (Bug#4526, Bug#4846)
cb50077 Fix auth-source-delete (Bug#26184)
a4767a6 Avoid assertion violations in gnutls.c
90110f8 Don't use a literal "C-u" in ispell.el help message text
f4e7f6d Improve documentation of 'seqp'
ed13639 Clarify usage and dependencies between several Flyspell features
Conflicts:
etc/NEWS
test/lisp/auth-source-tests.el
Diffstat (limited to 'lisp/term')
-rw-r--r-- | lisp/term/tty-colors.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el index ab9149e6b42..a776c830a25 100644 --- a/lisp/term/tty-colors.el +++ b/lisp/term/tty-colors.el @@ -824,10 +824,12 @@ A canonicalized color name is all-lower case, with any blanks removed." (replace-regexp-in-string " +" "" (downcase color)) color))) -(defun tty-color-24bit (rgb) - "Return pixel value on 24-bit terminals. Return nil if RGB is -nil or not on 24-bit terminal." - (when (and rgb (= (display-color-cells) 16777216)) +(defun tty-color-24bit (rgb &optional display) + "Return 24-bit color pixel value for RGB value on DISPLAY. +DISPLAY can be a display name or a frame, and defaults to the +selected frame's display. +If DISPLAY is not on a 24-but TTY terminal, return nil." + (when (and rgb (= (display-color-cells display) 16777216)) (let ((r (lsh (car rgb) -8)) (g (lsh (cadr rgb) -8)) (b (lsh (nth 2 rgb) -8))) @@ -850,7 +852,7 @@ If FRAME is not specified or is nil, it defaults to the selected frame." (error "Invalid specification for tty color \"%s\"" name)) (tty-modify-color-alist (append (list (tty-color-canonicalize name) - (or (tty-color-24bit rgb) index)) + (or (tty-color-24bit rgb frame) index)) rgb) frame)) @@ -1026,7 +1028,7 @@ might need to be approximated if it is not supported directly." (or (assoc color (tty-color-alist frame)) (let ((rgb (tty-color-standard-values color))) (and rgb - (let ((pixel (tty-color-24bit rgb))) + (let ((pixel (tty-color-24bit rgb frame))) (or (and pixel (cons color (cons pixel rgb))) (tty-color-approximate rgb frame))))))))) |