help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add a hook for color-theme switching


From: stardiviner
Subject: Add a hook for color-theme switching
Date: Fri, 1 Dec 2017 18:45:53 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Here is a case:

I use package =hl-sexp= to highlight sexp in Lisp code:

#+begin_src emacs-lisp
(use-package hl-sexp
  :ensure t
  :config
  (set-face-attribute 'hl-sexp-face nil
                      :background (cl-case (alist-get 'background-mode
(frame-parameters))
                                    ('light
                                     (color-darken-name (face-background
'default) 7))
                                    ('dark
                                     (color-lighten-name
(face-background 'default) 4)))
                      )
  )
#+end_src

When I start Emacs, the face ~hl-sexp-face~ is been set by the Emacs
initialized
color-theme. Then I use package =circadian= to auto switch color-theme
or manually
switch color-theme with command =disable-theme= and =load-theme=. But
this face
~hl-sexp-face~ is defined already, usually not good for another switched
color-theme.

So I hope there is a hook for switching color-theme like
~color-theme-switch-hook~ etc.

This is useful for package =circadian=.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]