[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
toggle-light-dark-mode (was: Re: "modern" colors Re: Changes for emacs 2
From: |
Alfred M. Szmidt |
Subject: |
toggle-light-dark-mode (was: Re: "modern" colors Re: Changes for emacs 28) |
Date: |
Tue, 15 Sep 2020 02:54:40 -0400 |
[Tip, it is a good idea to change the subject!]
I like using a light theme during the day and a dark theme during the
night when I'm in a dark room. I use a function to toggle between those
two different themes. Here is some code based on my personal
configuration:
_____
(defun toggle-light-dark-theme--custom-choices (theme)
"Function used to create the choice widget options of the
toggle-light-dark-theme custom variables."
`(const :tag ,(symbol-name theme) ,theme))
(defcustom toggle-light-dark-theme-light-theme 'modus-operandi
"The light theme that the function toggle-light-dark-theme will use."
:type `(choice ,@(mapcar #'toggle-light-dark-theme--custom-choices
(custom-available-themes))))
(defcustom toggle-light-dark-theme-dark-theme 'tango-dark
"The dark theme that the function toggle-light-dark-theme will use."
:type `(choice ,@(mapcar #'toggle-light-dark-theme--custom-choices
(custom-available-themes))))
(defvar toggle-light-dark-theme--current-theme 'light)
(defun toggle-light-dark-theme ()
"Disables all custom enabled themes and then toggles between a
light and a dark theme, which are the values of the variables
toggle-light-dark-theme-light-theme and toggle-light-dark-theme-dark-theme."
(interactive)
(mapc #'disable-theme custom-enabled-themes)
(cond ((eq toggle-light-dark-theme--current-theme 'light)
(load-theme toggle-light-dark-theme-dark-theme)
(setq toggle-light-dark-theme--current-theme 'dark))
(t (load-theme toggle-light-dark-theme-light-theme)
(setq toggle-light-dark-theme--current-theme 'light))))
_____
Maybe we could use something like this and then add buttons to the menu
and the tool bar? The tool bar could use an icon like the image
attached (the image is just illustrative, it probably has copyright).
This looks like a good idea.
I think something in the tool-bar is a bit much, I don't think it is
the most used option that should that have such a high visibility --
rather I think users would like to toggle it once, so the menu-bar
would be a better place where the user would also be prompt to save
their settings if they quit emacs.
Would you like to purpose a patch for this?
- Re: "modern" colors Re: Changes for emacs 28, (continued)
- Re: "modern" colors Re: Changes for emacs 28, Göktuğ Kayaalp, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Gregory Heytings, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Göktuğ Kayaalp, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Gregory Heytings, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Göktuğ Kayaalp, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Stefan Kangas, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Colin Baxter, 2020/09/13
- Re: "modern" colors Re: Changes for emacs 28, Ergus, 2020/09/12
- Re: "modern" colors Re: Changes for emacs 28, Alfred M. Szmidt, 2020/09/12
- Re: "modern" colors Re: Changes for emacs 28, Caio Henrique, 2020/09/12
- toggle-light-dark-mode (was: Re: "modern" colors Re: Changes for emacs 28),
Alfred M. Szmidt <=
- Re: toggle-light-dark-mode, Caio Henrique, 2020/09/15
- Re: toggle-light-dark-mode, Juri Linkov, 2020/09/15
- Re: toggle-light-dark-mode, Caio Henrique, 2020/09/15
- Re: toggle-light-dark-mode, Juri Linkov, 2020/09/16
- Re: toggle-light-dark-mode, Protesilaos Stavrou, 2020/09/16
- Re: toggle-light-dark-mode, Juri Linkov, 2020/09/16
- Re: toggle-light-dark-mode, Stefan Monnier, 2020/09/16
- Re: toggle-light-dark-mode, Arthur Miller, 2020/09/17
- RE: "modern" colors Re: Changes for emacs 28, Drew Adams, 2020/09/12
- Re: "modern" colors Re: Changes for emacs 28, Ricardo Wurmus, 2020/09/12