[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about customising faces
From: |
Joost Kremers |
Subject: |
Question about customising faces |
Date: |
Mon, 29 Aug 2022 13:30:21 +0200 |
User-agent: |
mu4e 1.8.3; emacs 28.1.91 |
Hi list,
I wanted to customise the faces used by isearch / lazy-highlight, and I ended up
having to do the following in order to get it to work for both the initial frame
and any additional frames created during the Emacs session (with
`make-frame-command`):
```
;; We need to set these faces twice: once for the initial frame...
(set-face-attribute 'isearch nil :background nil
:foreground "#d33682")
(set-face-attribute 'isearch-group-1 nil :background "lightskyblue1"
:foreground "#d33682")
(set-face-attribute 'isearch-group-2 nil :background "DarkSeaGreen1"
:foreground "#d33682")
(set-face-attribute 'lazy-highlight nil :background nil
:foreground nil :box "#d33682")
;; ...and once for all future frames:
(set-face-attribute 'isearch t :background 'unspecified
:foreground "#d33682")
(set-face-attribute 'isearch-group-1 t :background "lightskyblue1"
:foreground "#d33682")
(set-face-attribute 'isearch-group-2 t :background "DarkSeaGreen1"
:foreground "#d33682")
(set-face-attribute 'lazy-highlight t :background 'unspecified
:foreground 'unspecified :box "#d33682")
```
So basically, I need two calls to `set-face-attribute` for each face, I haven't
found a way to reduce these to one call per face.
Am I overlooking something here? Is there a way to do this better?
I should perhaps point out that I use a custom theme (solarized-theme) and that
this invocation is placed inside the `use-package` call that loads this theme
and activates it:
```
(use-package solarized-theme
:ensure t
:config
(setq solarized-scale-org-headlines nil
solarized-use-variable-pitch nil)
(load-theme 'solarized-light t)
;; We need to set these faces twice: once for the current frame...
(set-face-attribute 'isearch nil :background nil
:foreground "#d33682")
(set-face-attribute 'isearch-group-1 nil :background "lightskyblue1"
:foreground "#d33682")
(set-face-attribute 'isearch-group-2 nil :background "DarkSeaGreen1"
:foreground "#d33682")
(set-face-attribute 'lazy-highlight nil :background nil
:foreground nil :box "#d33682")
;; And once for all future frames.
(set-face-attribute 'isearch t :background 'unspecified
:foreground "#d33682")
(set-face-attribute 'isearch-group-1 t :background "lightskyblue1"
:foreground "#d33682")
(set-face-attribute 'isearch-group-2 t :background "DarkSeaGreen1"
:foreground "#d33682")
(set-face-attribute 'lazy-highlight t :background 'unspecified
:foreground 'unspecified :box "#d33682"))
```
TIA
Joost
--
Joost Kremers
Life has its moments
- Question about customising faces,
Joost Kremers <=
- Re: Question about customising faces, Eli Zaretskii, 2022/08/29
- Re: Question about customising faces, Joost Kremers, 2022/08/29
- Re: Question about customising faces, Stefan Monnier, 2022/08/29
- Re: Question about customising faces, Joost Kremers, 2022/08/30
- Re: Question about customising faces, Stefan Monnier, 2022/08/30
- Re: Question about customising faces, Joost Kremers, 2022/08/30
- Re: Question about customising faces, Stefan Monnier, 2022/08/30
- Re: Question about customising faces, Eli Zaretskii, 2022/08/29
- Re: Question about customising faces, Joost Kremers, 2022/08/30
- Re: Question about customising faces, Eli Zaretskii, 2022/08/30