Add dark theme toggle

This commit is contained in:
Antoine Martin 2020-05-23 15:33:17 +02:00
parent ea0db40573
commit f5fc3d2c6f

View file

@ -1,6 +1,7 @@
* Table of Contents :TOC: * Table of Contents :TOC:
- [[#misc][Misc]] - [[#misc][Misc]]
- [[#theme][Theme]] - [[#theme][Theme]]
- [[#dark-theme-toggle][Dark theme toggle]]
- [[#font][Font]] - [[#font][Font]]
- [[#line-numbers][Line numbers]] - [[#line-numbers][Line numbers]]
- [[#battery-indicator][Battery indicator]] - [[#battery-indicator][Battery indicator]]
@ -38,6 +39,37 @@ https://github.com/hlissner/emacs-doom-themes
(setq doom-theme 'doom-solarized-light) (setq doom-theme 'doom-solarized-light)
#+END_SRC #+END_SRC
** Dark theme toggle
I've come to prefer using a light theme during the day, and a dark theme at
night. Using a dark theme with daylight leads to cranking up the screen
brightness, which hurts my eyes more than using the light theme.
Set my light and dark themes:
#+BEGIN_SRC emacs-lisp
(setq my/light-theme doom-theme
my/dark-theme 'doom-one)
#+END_SRC
Function to toggle between the two easily:
#+BEGIN_SRC emacs-lisp
(defun my/toggle-dark-theme ()
(interactive)
(if (eq my/dark-theme doom-theme)
(load-theme my/light-theme t)
(load-theme my/dark-theme t)))
#+END_SRC
Bind this to =SPC t d=:
#+BEGIN_SRC emacs-lisp
(map! :leader
(:prefix-map ("t" . "toggle")
:desc "Dark theme" "d" #'my/toggle-dark-theme))
#+END_SRC
** Font ** Font
Doom exposes five (optional) variables for controlling fonts in Doom. Here are Doom exposes five (optional) variables for controlling fonts in Doom. Here are