How can I adjust the term
face in the new Emacs to get the same control that was possible with ansi-term-color-vector
?
One of the new features in Emacs 24.3 seems to be that it revamps the mechanism to control the face of term
buffers, i.e.:
The variables
term-default-fg-color
andterm-default-bg-color
are now deprecated in favor of the customizable faceterm
.You can customize how to display ANSI terminal colors and styles by customizing the corresponding
term-color-COLOR
,term-color-underline
andterm-color-bold
faces.
Mickey from Mastering Emacs comments the following:
If, like me, you customized
ansi-color-names-vector
to change the default term colours I suggest you switch to using the faces now. The good news here is you can, should desire to, change more than just the colours for each ANSI Color: there’s nothing stopping you from forcing a different font for certain colours
Like Mickey, I was also using ansi-color-names-vector
to make sure that the color of my term
buffers looked well on dark themes (e.g. tango-dark
)
(setq ansi-term-color-vector [unspecified “black” “red3” “lime green” “yellow3” “DeepSkyBlue?3” “magenta3” “cyan3” “white”])
But this now results in an error:
"error in process filter: Invalid face; unspecified"
In an attempt to use the new face term
, when I go to M-x describe-face term
, I see the following:
[] Font Family
[] Font Foundry
[] Width
[] Height
[] Weight
[] Slant
[] Underline
[] Overline
[] Strike-through
[] Box around text
[] Inverse-video
[] Foreground
[] Background
[] Stipple
[x] Inherit
But how do I adjust these settings to get the same effect I achieved using ansi-term-color-vector
?
I am still unable to fix the colors. Here is the menu that I get for M-x customize-theme tango-dark
:
And here is an example of one of the colors/faces in a terminal that are hard to see:
This worked for me in Emacs 24.3.1 to set the colors of term and ansi-term. Just change the colors to your preferred values (with the background adjusted accordingly).
;; term
(defface term-color-black
'((t (:foreground "#3f3f3f" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-red
'((t (:foreground "#cc9393" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-green
'((t (:foreground "#7f9f7f" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-yellow
'((t (:foreground "#f0dfaf" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-blue
'((t (:foreground "#6d85ba" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-magenta
'((t (:foreground "#dc8cc3" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-cyan
'((t (:foreground "#93e0e3" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-white
'((t (:foreground "#dcdccc" :background "#272822")))
"Unhelpful docstring.")
'(term-default-fg-color ((t (:inherit term-color-white))))
'(term-default-bg-color ((t (:inherit term-color-black))))
;; ansi-term colors
(setq ansi-term-color-vector
[term term-color-black term-color-red term-color-green term-color-yellow
term-color-blue term-color-magenta term-color-cyan term-color-white])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With