all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question about customising faces
@ 2022-08-29 11:30 Joost Kremers
  2022-08-29 13:08 ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: Joost Kremers @ 2022-08-29 11:30 UTC (permalink / raw)
  To: gnu-emacs-help

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



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-09-03 15:18 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-29 11:30 Question about customising faces Joost Kremers
2022-08-29 13:08 ` Eli Zaretskii
2022-08-29 20:07   ` Joost Kremers
2022-08-29 20:47     ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-08-30  6:58       ` Joost Kremers
2022-08-30 13:00         ` Stefan Monnier
2022-08-30 20:57           ` Joost Kremers
2022-08-30 21:23             ` Stefan Monnier
2022-09-03 15:18           ` Joost Kremers
2022-08-30  2:30     ` Eli Zaretskii
2022-08-30  6:44       ` Joost Kremers
2022-08-30 11:49         ` Eli Zaretskii
2022-08-30 20:48           ` Joost Kremers
2022-08-30 15:52         ` Gregory Heytings
2022-08-30 16:54           ` Eli Zaretskii
2022-08-30 17:50             ` Gregory Heytings
2022-08-30 18:19               ` Eli Zaretskii
2022-08-30 18:31                 ` Gregory Heytings
2022-08-30 18:34                   ` Eli Zaretskii
2022-08-30 18:48                     ` Gregory Heytings
2022-08-30 18:56                       ` Eli Zaretskii
2022-08-30 19:15                         ` Gregory Heytings
2022-08-30 20:36                           ` Joost Kremers
2022-08-31  2:25                           ` Eli Zaretskii
2022-08-31  8:18                             ` Gregory Heytings
2022-08-30 21:46                         ` [External] : " Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.