Like most sane people, I don’t use Emacs’ default theme but instead rely on custom themes.
Through a thoughtful choice of colors, the venerable editor can feel like a modern beast (or a retro oddity if that’s what you’re into).
I cycle through several themes but my current favorite is chocolate. I def’ recommend it: very easy on the eyes and yummy 🍫.
Other favorites are white-sand, dracula and for a more retro vibe comidia.
A matter of taste
I really love the themes I use. At least 95% of them.
But there are several discrepancies between them that annoy me:
- whether variable pitch is on for outlines
- whether different outline levels have different colors
- mode-line look: either “box” or “flat”
- active buffer mode-line not standing out sufficiently
^Lcharacter) not of the same color as comments
show-paren-*faces colors not standing out
regioncolor too close to
hl-lineand / or
Yeah, I’m a picky dude.
The way I used to deal with this was by forking the themes and maintaining my own versions.
But this was cumbersome and I had the feeling there was a better way.
I stumbled on this blog post about beautifying org-mode on Abhinav Tushar’s blog and realized that Spacemacs has “native” theme override capabilities.
Once I discovered this I decided to
switch to Spacemacs delve into Spacemacs source code to find out how it’s done.
It appears that the outer part of Spacemacs’ code is divided into special kinds of packages called layers (as opposed to the core part).
The theme override code is provided by the theming layer (code) and the trick seems to be to call
Porting to vanilla Emacs 🍦
I could have called
custom-set-faces directly from my init.el but got a better idea.
Why not reuse the same format as Spacemacs for defining theme overrides?
And why not just simply port the whole layer to vanilla Emacs as regular package?
As it turns out, it was pretty trivial to do.
Introducing new package: space-theming.
Also please note for Emacs 27 users, you might have to set the following:
(setq custom--inhibit-theme-enable nil)
As a bonus here is my setup for
(setq space-theming-modifications '((chocolate ;; strawberry active region (region :background "#C77497" :foreground "black") (show-paren-match :background "white" :foreground "black") (show-paren-mismatch :background "red" :foreground "white") ;; active / inactivate buffer mode-line (mode-line :background "#594A3B") ; chocolate-dark-yellow (mode-line-inactive :background "#2b241d") ; darker derivative of chocolate-dark-yellow (fringe :background "#2b241d") ; same as mode-line-inactive ;; ^L are comments (form-feed-line :strike-through "#705B5F") ;; :foreground of `font-lock-comment-delimiter-face' ;; babel (org-block :inherit default) (org-block-begin-line :foreground "#594A3B") (org-block-end-line :foreground "#594A3B") ;; dired (dired-directory :foreground "#EAEAFE") ; chocolate-hue-2 ;; bookmarks (bmkp-local-directory :foreground "#45AFBD") (bmkp-remote-file :foreground "#C55D67")))
You can see my customization on the left VS the default faces on the right.
- it’s way clearer that the bottom buffer is the active one
- the region went from “I’m a ninja and want to look the same as a mode-line” to “Hey look at me!”.
- the unobtrusive form feed in the top buffer