Next: , Previous: , Up: Advanced customization   [Index]

7.15 DIY Load theme depending on time of day

While we do provide modus-themes-toggle to manually switch between the themes, users may also set up their system to perform such a task automatically at sunrise and sunset.

This can be accomplished by specifying the coordinates of one’s location using the built-in solar.el and then configuring the circadian package:

(use-package solar                      ; built-in
  :config
  (setq calendar-latitude 35.17
        calendar-longitude 33.36))

(use-package circadian                  ; you need to install this
  :ensure t
  :after solar
  :config
  (setq circadian-themes '((:sunrise . modus-operandi)
                           (:sunset  . modus-vivendi)))
  (circadian-setup))