Skip to content

guidoschmidt/circadian.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MELPA
https://travis-ci.org/guidoschmidt/circadian.el


Logo

Theme-switching for Emacs based on daytime

Conception

Circadian tries to help reducing eye strain that may arise from difference of your display brightness and the surrounding light.

Inspired by color temperature shifting tools and brightness adaption software like:


Usage & Configuration

Install circadian.el with use-package or straight.el

Configuration with times

To auto-switch a theme on a specific time, use time strings:

(use-package circadian
  :ensure t
  :config
  (setq circadian-themes '(("8:00" . wombat)
                           ("19:30" . adwaita)))
  (circadian-setup))

Configuration with :sunrise and :sunset

To auto-switch a theme based on your current locations sunrise and sunset times:

  1. Make sure to set your latitude and longitude (Get them e.g. at latlong.net):
      (setq calendar-latitude 40.712776)
      (setq calendar-longitude -74.005974)
  2. Configure circadian-themes using the :sunset and :sunset
    (use-package circadian
      :ensure t
      :config
      (setq circadian-themes '((:sunrise . adwaita)
                               (:sunset  . wombat)))
      (circadian-setup))

Randomly selection from theme list

Circadian.el can randomly select a theme from a given list, e.g here using doom-themes at sunset:

(use-package doom-themes)

(use-package circadian
  :config
  (setq circadian-themes '((:sunrise . doom-gruvbox-light)
                           (:sunset . (doom-dracula doom-gruvbox))))
  (add-hook 'emacs-startup-hook #'circadian-setup)
  (circadian-setup))

Use with custom themes

To use custom themes, install them from MELPA using e.g. use-package or straight.el.

Example usage featuring hemera-themes and nyx-theme (with use-package). Make sure to use :defer keyword. Omitting it may lead to broken colors (see issue 9):

;; Install additinal themes from melpa
;; make sure to use :defer keyword
(use-package hemera-theme :ensure :defer)
(use-package nyx-theme :ensure :defer)

Verbose messages

By default circadian will not log any messages. however for development or just getting more information, one can enable a more verbose message log:

(setq circadian-verbose t)

Hooks

circadian provides two hooks:

  • circadian-before-load-theme-hook
  • circadian-after-load-theme-hook

e.g. I like to override any themes cursor color to a very bright color via:

(add-hook 'circadian-after-load-theme-hook
          #'(lambda (theme)
              ;; Line numbers appearance
              (setq linum-format 'linum-format-func)
              ;; Cursor
              (set-default 'cursor-type 'box)
              (set-cursor-color "#F52503")))

Todos & Ideas


Development & Testing

Install Emacs cask environment. On macOS you canr use homebrew with: brew install cask.

  1. Clone the circadian.el repository: git clone [email protected]:guidoschmidt/circadian.el.git
  2. cd into the git project directory with cd circadian.el and install dependencies via cask
  3. Run test using make test