emacs-devel
[Top][All Lists]
Advanced

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

Re: ELPA: New package: nano-theme


From: Nicolas P. Rougier (inria)
Subject: Re: ELPA: New package: nano-theme
Date: Thu, 30 Sep 2021 09:21:37 +0200
User-agent: mu4e 1.6.6; emacs 27.2


I think it is possible by first setting the frame-background-mode (to 'dark or 'light in my case), then create a new frame and call frame-set-background-mode on the newly created frame. It seems to work consistently on my system but maybe this is a side effect. Here is the code:

#+BEGIN_SRC elisp
(defun nano-new-frame (&optional mode)
 (interactive)
 (let ((mode (or mode (frame-parameter nil 'background-mode)))
       (background-mode frame-background-mode)
       (selected-frame (selected-frame))
       (new-frame nil))

   ;; Set mode
   (setq frame-background-mode mode)
   (setq new-frame (make-frame-command))
   (select-frame new-frame)

   ;; This forces recomputation of faces on the new frame
   (frame-set-background-mode (selected-frame))
(when (eq mode 'light)
     (set-foreground-color nano-light-foreground)
     (set-background-color nano-light-background))

   (when (eq mode 'dark)
     (set-foreground-color nano-dark-foreground)
     (set-background-color nano-dark-background))

   ;; Restore background mode
   (setq frame-background-mode background-mode)
   (frame-set-background-mode selected-frame)
new-frame))
#+END_SRC

Nicolas

Stefan Monnier <monnier@iro.umontreal.ca> writes:

I search for how to apply a theme to a single frame but did not find any
obvious way.

Custom themes are sets of user settings (i.e. affecting typically
variables and faces), so they're naturally global.

So you can't have that "single frame" effect directly by specifying face
settings in the theme.

What you can do instead is:
- You can have a custom theme set a particular minor mode (provided as part of the theme, for example) and arrange for that minor mode to
  affect faces in a single frame.
- You can use the DISPLAY spec of face settings to restrict your face settings to specific classes of frames. The DISPLAY specs could be extended to be more flexible if needed (file a bug report for that).


        Stefan




reply via email to

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