diff options
author | Miha Rihtaršič <miha@kamnitnik.top> | 2021-10-05 08:53:36 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-05 08:53:36 +0200 |
commit | 0fa2279b90bf5a638d8377032b71135e1374e8fb (patch) | |
tree | b37e17ffbdadfc3b157ab33a98849226b0c6fed1 /test/lisp/ansi-color-tests.el | |
parent | 21dcb9830a46a6ed2c613e496b91f611ba7f6a27 (diff) | |
download | emacs-0fa2279b90bf5a638d8377032b71135e1374e8fb.tar.gz emacs-0fa2279b90bf5a638d8377032b71135e1374e8fb.tar.bz2 emacs-0fa2279b90bf5a638d8377032b71135e1374e8fb.zip |
Add support for 256-color and 24bit ANSI colors in ansi-color
* lisp/ansi-color.el (ansi-color--code-as-hex): New function to
convert from 256-color and 24-bit ANSI codes.
(ansi-color--face-vec-face): Add support for ANSI color codes greater
than 16
(ansi-color--update-face-vec): Add support for ANSI codes 38 and 48
which can specify 256-color and 24bit ANSI colors.
* test/lisp/ansi-color-tests.el (ansi-color-tests--strings): Add tests
for ANSI codes 38 and 34
Diffstat (limited to 'test/lisp/ansi-color-tests.el')
-rw-r--r-- | test/lisp/ansi-color-tests.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 953fdff8933..16a1ba4a892 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -27,7 +27,8 @@ (defvar ansi-color-tests--strings (let ((bright-yellow (face-foreground 'ansi-color-bright-yellow nil 'default)) - (yellow (face-foreground 'ansi-color-yellow nil 'default))) + (yellow (face-foreground 'ansi-color-yellow nil 'default)) + (custom-color "#87FFFF")) `(("Hello World" "Hello World") ("\e[33mHello World\e[0m" "Hello World" (:foreground ,yellow)) @@ -51,7 +52,14 @@ (ansi-color-bold (:foreground ,bright-yellow))) ("\e[1m\e[3m\e[5mbold italics blink\e[0m" "bold italics blink" (ansi-color-bold ansi-color-italic ansi-color-slow-blink)) - ("\e[10munrecognized\e[0m" "unrecognized")))) + ("\e[10munrecognized\e[0m" "unrecognized") + ("\e[38;5;3;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:foreground ,yellow)) + (ansi-color-bold (:foreground ,bright-yellow))) + ("\e[48;5;123;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:background ,custom-color))) + ("\e[48;2;135;255;255;1mHello World\e[0m" "Hello World" + (ansi-color-bold (:background ,custom-color)))))) (ert-deftest ansi-color-apply-on-region-test () (pcase-dolist (`(,input ,text ,face) ansi-color-tests--strings) |