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

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

Re: Add a hook for color-theme switching


From: stardiviner
Subject: Re: Add a hook for color-theme switching
Date: Sat, 2 Dec 2017 13:09:49 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0


On 12/02/2017 12:14 AM, Drew Adams wrote:
> I don't understand the problem.  Are you saying that when
> you switch to another theme (presumably a custom theme)
> the appearance of face `hl-sexp-face' changes?
>
>> So I hope there is a hook for switching color-theme like
>> `color-theme-switch-hook' etc.
> Do you mean that after you switch to another theme you
> want to invoke some code?  What code would you invoke?
> Is the idea just to make face `hl-sexp-face' have or
> keep the appearance you want?
Here is an example showing what I want:

#+begin_src emacs-lisp
(add-hook 'color-theme-load-hook
          (lambda ()
            (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

Then the custom faces can be changed automatically according the
color-theme switching.



reply via email to

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