How I Tweaked My Solarized Theme April 3, 2015
I am a recent convert to Solarized and so far I like it quite a bit better than what I used to use which was Monokai. I find Solarized’s dark theme easier on my eyes especially after a long day of work.
However as with almost everything Solarized isn’t perfect. Or rather, it wasn’t implemented to be exactly the way I wanted. Specifically the “line number” and “fringe” regions are of have a different background colour, which I find rather distracting; and there is a small issue with line numbers of comment lines being styled as italic which IMO shouldn’t be.
The author of the theme may have reasons to colour things one way or the other so I didn’t bother submitting a pull request. After all background colour for line number and fringe is arguably a matter of personal preferences.
So I took it upon myself to make a few tweaks to the theme. And instead of modifying the theme’s
source, I used Emacs’s handy
(add-hook 'after-make-frame-functions (lambda (frame) (select-frame frame) (if (display-graphic-p) (progn (set-face-attribute 'fringe frame :background (face-attribute 'default :background) :foreground (face-attribute 'fringe :foreground)) (set-face-attribute 'linum frame :background (face-attribute 'default :background) :foreground (face-attribute 'linum :foreground) :slant 'normal)))))
The above sets the line number and fringe’s background colour to match the background colour of the
default face (i.e. the text area’s background colour), and also correct the line number’s italic
style at the same time.
This way, the Solarized source is left unaltered, the “tweak” doesn’t have any hard-coded colour values and it works with both light and dark themes as well.