1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Add support for 256-color and 24bit ANSI colors in term-mode

(term-ansi-face-already-done): Make obsolete
(term--maybe-brighten-color): Remove
(term--color-as-hex): New function
(term-handle-colors-array): Make obsolete in favour of the new
function 'term--handle-colors-list'.
(term--handle-colors-list): New function, that can also handle ANSI
codes 38 and 48.
(term-handle-ansi-escape): Use it

* test/lisp/term-tests.el (ansi-test-strings): Add tests for 256-color
and 24bit ANSI colors
This commit is contained in:
Miha Rihtaršič 2021-09-25 23:28:08 +02:00 committed by Lars Ingebrigtsen
parent 0fa2279b90
commit 76895fcd0b
7 changed files with 149 additions and 128 deletions

View file

@ -42,6 +42,9 @@
`( :foreground "unspecified-fg"
:background ,(face-background 'term-color-bright-yellow nil 'default)
:inverse-video nil))
(defvar custom-color-fg-props
`( :foreground "#87FFFF"
:background "unspecified-bg" :inverse-video nil))
(defvar ansi-test-strings
`(("\e[33mHello World\e[0m"
@ -71,7 +74,18 @@
,(propertize "Hello World" 'font-lock-face
`(,yellow-fg-props :inherit term-bold))
,(propertize "Hello World" 'font-lock-face
`(,bright-yellow-fg-props :inherit term-bold)))))
`(,bright-yellow-fg-props :inherit term-bold)))
("\e[38;5;3;1mHello World\e[0m"
,(propertize "Hello World" 'font-lock-face
`(,yellow-fg-props :inherit term-bold))
,(propertize "Hello World" 'font-lock-face
`(,bright-yellow-fg-props :inherit term-bold)))
("\e[38;5;123;1mHello World\e[0m"
,(propertize "Hello World" 'font-lock-face
`(,custom-color-fg-props :inherit term-bold)))
("\e[38;2;135;255;255;1mHello World\e[0m"
,(propertize "Hello World" 'font-lock-face
`(,custom-color-fg-props :inherit term-bold)))))
(defun term-test-screen-from-input (width height input &optional return-var)
(with-temp-buffer