emacs-devel
[Top][All Lists]
Advanced

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

Re: "modern" colors Re: Changes for emacs 28


From: Caio Henrique
Subject: Re: "modern" colors Re: Changes for emacs 28
Date: Sat, 12 Sep 2020 22:14:52 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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).

Attachment: light dark icon.png
Description: toggle light dark icon


This way, there is no need to change the default theme :).

reply via email to

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