Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/guidoschmidt/circadian.el

Theme-switching for Emacs based on daytime
https://github.com/guidoschmidt/circadian.el

circadian daytime emacs emacs-conf emacs-configuration emacs-lisp theme themes

Last synced: 3 months ago
JSON representation

Theme-switching for Emacs based on daytime

Lists

README

        



MELPA




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







Logo

circadian


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:

- [redshift](https://wiki.archlinux.org/index.php/Redshift)
- [f.lux](https://justgetflux.com/news/pages/mac/)
- [Lumen](https://github.com/anishathalye/lumen)

---

### Example usage

##### Switching themes on time of day

Example usage featuring [hemera-themes](https://github.com/GuidoSchmidt/emacs-hemera-theme)
and [nyx-theme](https://github.com/GuidoSchmidt/emacs-nyx-theme) (with use-package). Make sure
to use `:defer` keyword. Omitting it may lead to broken colors
(see [issue 9](https://github.com/guidoschmidt/circadian.el/issues/9)):

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

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

##### Switching themes on sunrise & sunset

Be sure to set your latitude and longitude (Get them e.g. at [latlong.net](https://www.latlong.net/)):

```elisp
;; Install additinal themes from melpa
;; make sure to use :defer keyword
(use-package apropospriate-theme :ensure :defer)
(use-package nord-theme :ensure :defer)

(use-package circadian
:ensure t
:config
(setq calendar-latitude 49.0)
(setq calendar-longitude 8.5)
(setq circadian-themes '((:sunrise . apropospriate-light)
(:sunset . nord)))
(circadian-setup))
```

---

### 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:

```elisp
(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

- Is it possible to interpolate between themes/colors?
- Can brightness sensors (e.g. laptops) be queried to control dimming?
- Load themes by mode [reddit.com/r/emacs](https://www.reddit.com/r/emacs/comments/72ukrx/theme_preferences/)
- Load themes by machine name [reddit.com/r/emacs](https://www.reddit.com/r/emacs/comments/72ukrx/theme_preferences/)
- Load themes by wifi/location? [reddit.com/r/emacs](https://www.reddit.com/r/emacs/comments/72ukrx/theme_preferences/)

---

### Development

Install Emacs [cask](https://github.com/cask/cask) environment. On macOS you
canr use [homebrew](https://brew.sh/) with: `brew install cask`.

0. Clone the circadian.el repository: `git clone [email protected]:guidoschmidt/circadian.el.git`
1. `cd` into the git project directory with `cd circadian.el` and install dependencies via [`cask`](https://github.com/cask/cask)
2. Run test using `make test`