rougier / nano-theme

GNU Emacs / N Λ N O Theme
GNU General Public License v3.0
376 stars 35 forks source link

Add toggle function #3

Closed bdarcus closed 3 years ago

bdarcus commented 3 years ago

A minor thing to consider; may or may not be a good idea here:

Rather than, or in addition to, dedicated "light" and "dark" interactive functions, how about a modus-like "toggle" function?

https://github.com/protesilaos/modus-themes/blob/e98a4eaa8a4ec394c585af525612f8b181b602fc/modus-themes.el#L3514

It seems modus has the toggle function interactive, and the functions it references not.

rougier commented 3 years ago

Toggle function would be a good addition yes (+ a custom toggle setting) I'll try to do that (unless you want to make a PR)

merement commented 3 years ago

Since there are only two mutually exclusive themes, they are easy to toggle. I'm using a code like this

(setq-default my/light-theme-p t)
(defun my/load-light-theme ()
           (setq my/light-theme-p t)
           (nano-light))
(defun my/load-dark-theme ()
           (setq my/light-theme-p nil)
           (nano-dark))

(load-theme 'nano t)
(global-set-key [f5] (lambda ()
                   (interactive)
                   (if my/light-theme-p
                       (my/load-dark-theme)
                       (my/load-light-theme))))
rougier commented 3 years ago

I've just added a nano-theme-toggle