aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIllia Ostapyshyn <ilya.ostapyshyn@gmail.com>2023-09-23 00:31:51 +0200
committerGabriele Bozzola <sbozzolator@gmail.com>2024-01-02 08:40:56 -0800
commitf76de08cf62722a8c532b889a9361bbcc5c83972 (patch)
tree5f012b424e1ae1c4f6aaef56bb69d230d2e4fe48
parent94e2b0b2b4a750e7907dacd5b4c0584900846dd1 (diff)
Add separate faces for bright ANSI colors
* vterm.el (vterm-color-bright-*, vterm-color-palette): New faces. (vterm--get-color): Use new bright faces. * README.md: Mention new faces.
-rw-r--r--README.md12
-rw-r--r--vterm.el104
2 files changed, 83 insertions, 33 deletions
diff --git a/README.md b/README.md
index 64de4b2..e3b93bc 100644
--- a/README.md
+++ b/README.md
@@ -529,9 +529,7 @@ is a global minor mode in Emacs, you can use `M-x blink-cursor-mode` to toggle.
## Colors
-Set the `:foreground` and `:background` attributes of the following faces to a
-color you like. The `:foreground` is ansi color 0-7, the `:background` attribute
-is ansi color 8-15.
+Customize the following faces to your liking.
- vterm-color-black
- vterm-color-red
@@ -541,6 +539,14 @@ is ansi color 8-15.
- vterm-color-magenta
- vterm-color-cyan
- vterm-color-white
+- vterm-color-bright-black
+- vterm-color-bright-red
+- vterm-color-bright-green
+- vterm-color-bright-yellow
+- vterm-color-bright-blue
+- vterm-color-bright-magenta
+- vterm-color-bright-cyan
+- vterm-color-bright-white
## Directory tracking and Prompt tracking
diff --git a/vterm.el b/vterm.el
index a0600ad..8c56e08 100644
--- a/vterm.el
+++ b/vterm.el
@@ -425,58 +425,98 @@ copy-mode and set to nil on leaving."
(defface vterm-color-black
`((t :inherit term-color-black))
- "Face used to render black color code.
-The foreground color is used as ANSI color 0 and the background
-color is used as ANSI color 8."
+ "Face used to render black color code."
:group 'vterm)
(defface vterm-color-red
`((t :inherit term-color-red))
- "Face used to render red color code.
-The foreground color is used as ANSI color 1 and the background
-color is used as ANSI color 9."
+ "Face used to render red color code."
:group 'vterm)
(defface vterm-color-green
`((t :inherit term-color-green))
- "Face used to render green color code.
-The foreground color is used as ANSI color 2 and the background
-color is used as ANSI color 10."
+ "Face used to render green color code."
:group 'vterm)
(defface vterm-color-yellow
`((t :inherit term-color-yellow))
- "Face used to render yellow color code.
-The foreground color is used as ANSI color 3 and the background
-color is used as ANSI color 11."
+ "Face used to render yellow color code."
:group 'vterm)
(defface vterm-color-blue
`((t :inherit term-color-blue))
- "Face used to render blue color code.
-The foreground color is used as ANSI color 4 and the background
-color is used as ANSI color 12."
+ "Face used to render blue color code."
:group 'vterm)
(defface vterm-color-magenta
`((t :inherit term-color-magenta))
- "Face used to render magenta color code.
-The foreground color is used as ansi color 5 and the background
-color is used as ansi color 13."
+ "Face used to render magenta color code."
:group 'vterm)
(defface vterm-color-cyan
`((t :inherit term-color-cyan))
- "Face used to render cyan color code.
-The foreground color is used as ansi color 6 and the background
-color is used as ansi color 14."
+ "Face used to render cyan color code."
:group 'vterm)
(defface vterm-color-white
`((t :inherit term-color-white))
- "Face used to render white color code.
-The foreground color is used as ansi color 7 and the background
-color is used as ansi color 15."
+ "Face used to render white color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-black
+ `((t :inherit ,(if (facep 'term-color-bright-black)
+ 'term-color-bright-black
+ 'term-color-black)))
+ "Face used to render bright black color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-red
+ `((t :inherit ,(if (facep 'term-color-bright-red)
+ 'term-color-bright-red
+ 'term-color-red)))
+ "Face used to render bright red color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-green
+ `((t :inherit ,(if (facep 'term-color-bright-green)
+ 'term-color-bright-green
+ 'term-color-green)))
+ "Face used to render bright green color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-yellow
+ `((t :inherit ,(if (facep 'term-color-bright-yellow)
+ 'term-color-bright-yellow
+ 'term-color-yellow)))
+ "Face used to render bright yellow color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-blue
+ `((t :inherit ,(if (facep 'term-color-bright-blue)
+ 'term-color-bright-blue
+ 'term-color-blue)))
+ "Face used to render bright blue color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-magenta
+ `((t :inherit ,(if (facep 'term-color-bright-magenta)
+ 'term-color-bright-magenta
+ 'term-color-magenta)))
+ "Face used to render bright magenta color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-cyan
+ `((t :inherit ,(if (facep 'term-color-bright-cyan)
+ 'term-color-bright-cyan
+ 'term-color-cyan)))
+ "Face used to render bright cyan color code."
+ :group 'vterm)
+
+(defface vterm-color-bright-white
+ `((t :inherit ,(if (facep 'term-color-bright-white)
+ 'term-color-bright-white
+ 'term-color-white)))
+ "Face used to render bright white color code."
:group 'vterm)
(defface vterm-color-underline
@@ -501,7 +541,15 @@ Only background is used."
vterm-color-blue
vterm-color-magenta
vterm-color-cyan
- vterm-color-white]
+ vterm-color-white
+ vterm-color-bright-black
+ vterm-color-bright-red
+ vterm-color-bright-green
+ vterm-color-bright-yellow
+ vterm-color-bright-blue
+ vterm-color-bright-magenta
+ vterm-color-bright-cyan
+ vterm-color-bright-white]
"Color palette for the foreground and background.")
(defvar-local vterm--term nil
@@ -1615,14 +1663,10 @@ the `vterm-color-underline' face is used in this case.
-12 background for cells with inverse video attribute, background
of the `vterm-color-inverse-video' face is used in this case."
(cond
- ((and (>= index 0) (< index 8))
+ ((and (>= index 0) (< index 16))
(face-foreground
(elt vterm-color-palette index)
nil 'default))
- ((and (>= index 8) (< index 16))
- (face-background
- (elt vterm-color-palette (% index 8))
- nil 'default))
((= index -11)
(face-foreground 'vterm-color-underline nil 'default))
((= index -12)