Search code examples
emacshighlightingemacs-faces

Getting Faces to Share Background Color in Emacs


I'm in the process of configuring linum, hlinum, and hl-line for Emacs 24, and something I'm running into some trouble with is getting the hlinum highlight to match/inherit the background color of the line highlight.

In my Elisp file responsible for face customizations, I have the following:

(eval-after-load 'hl-line
  '(progn
     (set-face-attribute 'hl-line nil
                         :background "#222222")))

(eval-after-load 'hlinum
  '(progn
     (set-face-attribute 'linum-highlight-face nil
                         :inherit 'hl-line)))

However, the hlinum face remains unchanged. Specifying the linum-highlight-face background manually works, but I'd rather have it pick up on the color for hl-line.

How can I get linum-highlight-face to use the same background color as hl-line?


Solution

  • Related to this StackOverflow question, I added

    :background 'unspecified
    

    below the :inherit line for hlinum, and it used the same color.