I am trying to customize org-agenda-* faces such as org-agenda-date, org-agenda-date-today, and org-agenda-date-weekend in my .emacs file. Normally, I install the use-package package to lazily load each package to reduce emacs init time. At first, in the code below I call set-face-attribute to customize those faces, but it is in vain.
(use-package org-mode
:config
(set-face-attribute 'org-agenda-date-today nil
:foreground "#FFFFEF"
:background "#3F3F3F"
:bold t))
Next, I found that other emacs users invoke the defface function to customize those faces instead, and it does also work in my setup.
(use-package zenburn-theme
:ensure t
:config
(load-theme 'zenburn t)
(defface org-agenda-date
'((t (:foreground "#BFEBBF"
:background "#3F3F3F"
:bold nil)))
"Face used in agenda for weekdays."
:group 'org-faces))
Edit: Lawlist's comment reminds me of using M-x customize-face to customize these faces and it works.
Between the three approaches defface, set-face-attribute, and customize-face, which one is the best way to customize faces? In case you have an alternative way to customize them, please share your approach here.
Thanks,
use-package
: emacs.stackexchange.com/a/17962/2287set-face-attribute
and now useface-spec-set
but I don't know the best way to do this…M-x customize-face
). It is far more fail-safe than trying to simulate its effect yourself using Lisp in your init file. It just works - does the right thing. And for more hygiene and safety, use a separate file for Customize-generated code - see variablecustom-file
.custom-file
).