3

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,

5
  • Here is a solution to customize select faces of the zenburn theme that does not utilize use-package: emacs.stackexchange.com/a/17962/2287
    – lawlist
    Commented Jan 12, 2017 at 2:51
  • @lawlist Thank you. That's another solution, and your answer also reminds me of the other method to customize the faces I will edit my question in a few minutes.
    – To Panitan
    Commented Jan 12, 2017 at 3:31
  • 2
    I used to use set-face-attribute and now use face-spec-set but I don't know the best way to do this…
    – amitp
    Commented Jan 12, 2017 at 3:37
  • 2
    Use Customize (in this case 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 variable custom-file.
    – Drew
    Commented Jan 12, 2017 at 16:58
  • @Drew Personally, I don't like the customize interface much, and I much prefer to break my settings down into small files with comments (which I believe customize would destroy, even with the excellent custom-file).
    – Alex
    Commented Sep 12, 2018 at 7:43

1 Answer 1

1

As suggested by amitp in a comment, try:

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.