Emacs Face Select Settings: Background color change only

Is there a way to define a face in Emacs (e.g. highlight, e.g. hl-line ) so that it only changes the background color (and Emacs uses the foreground color as if the word were not highlighted).

In particular, I tried the following in the theme of tango-dark

 (custom-set-faces '(region ((t (:inherit nil :background "RoyalBlue4")))) '(highlight ((t (:inherit region :background "dark olive green")))) '(hl-line ((t (:inherit highlight))))) 

and, as can be seen below, the selection of the area does in relation to the foreground font (i.e. only changes the background color):

enter image description here

, but highlighting the current line does't:

enter image description here

Why? and how can i get the same effect using hl-line ?

Update:

This seems like a bug in the tango-dark theme (Emacs built-in theme). The code works well with the default theme (which is loaded using emacs -Q ). I posted this on the official error mailing list.

+4
source share
1 answer

I struggled with this a while ago, and this seems to be a color theme bug.

However, I came up with a workaround. This works for me:

 (load-theme 'tango-dark t) (set-face-attribute 'highlight nil :foreground 'unspecified) 
+6
source

All Articles