{"id":170,"date":"2011-11-27T02:27:15","date_gmt":"2011-11-27T07:27:15","guid":{"rendered":"http:\/\/codefork.com\/blog\/?p=170"},"modified":"2011-11-27T02:27:15","modified_gmt":"2011-11-27T07:27:15","slug":"getting-the-solarized-theme-to-work-in-emacs","status":"publish","type":"post","link":"https:\/\/codefork.com\/blog\/index.php\/2011\/11\/27\/getting-the-solarized-theme-to-work-in-emacs\/","title":{"rendered":"Getting the Solarized Theme to Work in Emacs"},"content":{"rendered":"<p>I discovered the <a href=\"http:\/\/ethanschoonover.com\/solarized\">Solarized<\/a> color palette about a month ago, and have been using it since. I&#8217;ve found it helpful for reducing eye strain.<\/p>\n<p>Getting the palette colors to accurately display in terminal-based Emacs under Ubuntu 11.10 took a bit of work. There&#8217;s a lot of scattered info about this topic if you google around. I first tried to do it with as little modification to my system as possible (I&#8217;m a minimalist), but I found that I absolutely had to do these three things to get it working.<\/p>\n<p>1) <strong>Set the color palette in gnome-terminal.<\/strong> No matter what I tried, I could not get Emacs colors to look right without this step, so it&#8217;s a crucial one. Don&#8217;t skip it.<\/p>\n<p>Solarized comes with an Xdefaults file, but that didn&#8217;t work for me. This <a href=\"http:\/\/xorcode.com\/guides\/solarized-vim-eclipse-ubuntu\/\">blog post<\/a> had instructions for setting gnome-terminal colors using gconftool-2, and that worked very nicely.<\/p>\n<p>I put the commands in a handy little shell script that allows you to choose either the light or dark version of the palette. You can get it here:<\/p>\n<p><a href=\"https:\/\/gist.github.com\/1397104\">https:\/\/gist.github.com\/1397104<\/a><\/p>\n<p>2) <strong>Your TERM environment variable needs to be set to &#8220;xterm-256color.&#8221;<\/strong> The default &#8220;xterm&#8221; will cause the Solarized color theme to look completely crazy in emacs.<\/p>\n<p>Add the following line to your ~\/.bashrc line (if you already set TERM there or some elsewhere else, change it instead of adding this):<\/p>\n<p><code>export TERM=\"xterm-256color\"<\/code><\/p>\n<p>3) <strong>Use this version of the Emacs color theme for Solarized:<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/sellout\/emacs-color-theme-solarized\">https:\/\/github.com\/sellout\/emacs-color-theme-solarized<\/a><\/p>\n<p>Note that unless you&#8217;re using Emacs 24 (pre-release source code tarballs are available <a href=\"http:\/\/alpha.gnu.org\/gnu\/emacs\/pretest\/\">here<\/a>), you&#8217;ll also need the <a href=\"http:\/\/www.nongnu.org\/color-theme\/\">color-theme<\/a> package if you don&#8217;t already have it installed.<\/p>\n<p>Put the files in a directory. In your .emacs file, you&#8217;ll need to add the directory to your load-path; I also added a bit of conditional logic for how to load the color theme in Emacs 23 and 24, since I switch between them:<\/p>\n<pre>(add-to-list 'load-path \"~\/.emacs.d\/emacs-color-theme-solarized\")\r\n(if\r\n    (equal 0 (string-match \"^24\" emacs-version))\r\n    ;; it's emacs24, so use built-in theme \r\n    (require 'solarized-dark-theme)\r\n  ;; it's NOT emacs24, so use color-theme\r\n  (progn\r\n    (require 'color-theme)\r\n    (color-theme-initialize)\r\n    (require 'color-theme-solarized)\r\n    (color-theme-solarized-dark)))\r\n<\/pre>\n<p>That should do it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I discovered the Solarized color palette about a month ago, and have been using it since. I&#8217;ve found it helpful for reducing eye strain. Getting the palette colors to accurately display in terminal-based Emacs under Ubuntu 11.10 took a bit of work. There&#8217;s a lot of scattered info about this topic if you google around. &hellip; <a href=\"https:\/\/codefork.com\/blog\/index.php\/2011\/11\/27\/getting-the-solarized-theme-to-work-in-emacs\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Getting the Solarized Theme to Work in Emacs&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,19],"tags":[],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-emacs","category-lisp"],"_links":{"self":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":15,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}