(custom-theme-set-faces! 'doom-ir-black
      '(mode-line :foreground "blue")
    ;;'(mode-line :foreground t) 
    ;; also doesn't work
    ;;'(mode-line :foreground "#000000")
    ;; using hex codes for colors also doesn't work
      '(mode-line :background "black"))

In here I customize the mode-line. Customizing the background of the mode-line works but customizing the foreground does not. I have looked at the face with M-x list-faces-display and saw that the :foreground attribute is not enabled. this persists when trying to change the color of :box which is also disabled in this theme.

I have checked for a running Emacs daemon that could be preserving the old settings between sessions but this wasn't the case, just to make sure I also rebooted my machine.

How can I enable these attributes?

1 Answer 1


The arguments are more complicated than that. Use C-h f to view the help for this function:

custom-theme-set-faces is a byte-compiled function defined in

(custom-theme-set-faces THEME &rest ARGS)

Apply a list of face specs associated with theme THEME.

THEME should be a theme name (a symbol).  The special theme named
user refers to user settings applied via Customize.

The remaining ARGS should be a list where each entry is a list of
the form:


FACE should be a face name (a symbol).  If FACE is a face alias,
the setting refers to the parent face.

SPEC should be a face spec.  For details, see defface.

If we look at the help for defface (using C-h f again), then we find the following information about face specs:

SPEC should be a "face spec", i.e., an alist of the form

   ((DISPLAY . ATTS)...)

where DISPLAY is a form specifying conditions to match certain
terminals and ATTS is a property list (ATTR VALUE ATTR VALUE...)
specifying face attributes and values for frames on those
terminals.  On each terminal, the first element with a matching
DISPLAY specification takes effect, and the remaining elements in
SPEC are disregarded.

As a special exception, in the first element of SPEC, DISPLAY can
be the special value default.  Then the ATTS in that element
act as defaults for all the following elements.

For backward compatibility, elements of SPEC can be written
as (DISPLAY ATTS) instead of (DISPLAY . ATTS).

Each DISPLAY can have the following values:
 - default (only in the first element).
 - The symbol t, which matches all terminals.
 - An alist of conditions.  Each alist element must have the form
   (REQ ITEM...).  A matching terminal must satisfy each
   specified condition by matching one of its ITEMs.  Each REQ
   must be one of the following:
   - type (the terminal type).
     Each ITEM must be one of the values returned by
     window-system.  Under X, additional allowed values are
     motif, lucid, gtk and x-toolkit.
   - class (the terminal's color support).
     Each ITEM should be one of color, grayscale, or mono.
   - background (what color is used for the background text)
     Each ITEM should be one of light or dark.
   - min-colors (the minimum number of supported colors)
     Each ITEM should be an integer, which is compared with the
     result of display-color-cells.
   - supports (match terminals supporting certain attributes).
     Each ITEM should be a list of face attributes.  See
     display-supports-face-attributes-p for more information on
     exactly how testing is done.

In the ATTS property list, possible attributes are :family,
:width, :height, :weight, :slant, :underline,
:overline, :strike-through, :box, :foreground,
:background, :stipple, :inverse-video, and :inherit.

See Info node (elisp) Faces in the Emacs Lisp manual for more

If we put it all together, we see that we need to specify a theme name followed by any number of lists containing face names and face specs. Each face spec is an alist containing both conditions and a list of face attributes. The conditions can be really complicated to allow your theme to adapt to varying conditions such as the number of available colors, or they can just be t if you want the attributes to always apply.

Like this:

(custom-theme-set-faces 'doom-ir-black
  '(mode-line ((t . ((:foreground "blue")
                     (:background "black")))))
  '(another-face ((t . (…)))))

I recommend opening up one of the existing Emacs themes and taking a look at how they work.

  • You have a spelling mistake in your code, but even without that mistake the code still doesn't work, what is the issue? (the spelling mistake is the 'e' in custome-theme-set-faces
    – qKweint
    Commented Apr 17, 2022 at 13:04
  • Thanks, I fixed the typo. When you say that it doesn’t work, what do you mean? Do you get an error message or something?
    – db48x
    Commented Apr 17, 2022 at 17:32
  • I fixed the issue but I'm note sure what I did.
    – qKweint
    Commented Apr 23, 2022 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.