Getting Solarized Working with emacsclient in both GUI and Terminal

| Comments

Some time last year, I decided it was finally time to try out a new color theme in my terminals and text editor. I have been a long time user of the old, standard “Linux console” colors for a very long time. Those were the colors they gave me when I installed Slackware 3.0 in 1996, and they were pretty much the same as the ANSI colors my 8088-based MS-DOS machine back in the late 1980s. I guess that I had been clinging to those rainbow colors for over twenty years.


I’m not sure exactly what finally made me give up my old color theme and give Solarized a try, but I do remember listening to The Changelog’s interview with the creator of Solarized, Ethan Schoonover. I do know that I set my terminal emulator to the Solarized Dark colors, and I installed the Solarized Emacs theme and I forced myself to stick with it long enough to get used to it.

That wasn’t easy, though. For many, many weeks, every time I opened a terminal I would think to myself, “this doesn’t look right!” These days, I am more likely to say that when I happen to see a gray-on-black terminal. I’m going to call that progress.

emacsclient and Solarized

I’ve had a lot of trouble getting my Solarized terminals and emacsclient to play nicely together. When I first set things up, it was just awful. Opening Emacs in a terminal would make the colors go weird in any existing Emacs GUI instance and vice versa. It was just a mess.

I did manage to straighten that out pretty well, but things still weren’t quite right. Everything looked fine in the GUI, but most of the colors were pretty far off in the terminal. I do most of my heavier editing in the GUI, so the “wrong” colors were pretty easy to tolerate. Those bright red comments in the terminal were pretty horrible, though:

Some very wrong colors Correct colors

Finally making it work

First of all, I had to set up the correct colors in my terminal. I use Gnome Terminal, so I used Sigurd Gartmann’s scripts to configure my Gnome Terminal with the Solarized colors. I have tried running emacsclient in other terminals that aren’t configured with the Solarized colors, and the result looks very bad.

The hardest part was finding a version of the Solarized color theme for Emacs 24 that actually works well in a terminal. Michael Olsen’s fork of the Solarized color theme is working perfectly for me.