Installing Cobalt theme in Emacs

Posted by Miguel Rentes on September 19, 2016
Read more about emacs

I am a big fan of discovering how other developers work and lately I have started watching the “Day in the Life” series on Youtube:

On this excellent video, you can see at 00:45 the Cobalt theme in Sublime Text editor (I also use this editor at work):

Cobalt Theme in Sublime Text editor

Since I like a lot this theme and I also enjoy using Emacs, the logic step was to use this theme on Emacs as well. This theme is not installed by default on Emacs (btw Emacs 25.1 is out!) but you can install it quite easily. You have two options: install this theme and a group of other themes as a bundle by installing the package color-theme-modern from MELPA archive, or install just this theme.

To install the color-theme-modern package:

  • Add the MELPA archive on your Emacs init file:
(require 'package)
(add-to-list 'package-archives '("melpa" . ""))
  • Refresh the package archive contents:
M-x package-refresh-contents
  • Search for the color-theme-modern package on the packages list and install it.
  • Load the theme on your Emacs init file:
(load-theme 'cobalt t t)
(enable-theme 'cobalt)
  • Save the Emacs init file and load it:
M-x eval-buffer

Now everytime you start Emacs, you will be using the Cobalt theme.

Here are the screenshots for all the themes on the color-theme-modern package.

To install just the Cobalt theme:

  • Add a diretory to where the theme will be download to. I use a directory named themes under my ~/.emacs.d/ directory.
mkdir ~/.emacs.d/themes
  • Download the Cobalt theme .el file:
$ cd ~/.emacs.d/themes
$ curl -LO
  • Add the theme file to the Emacs custom themes load path, in the Emacs init file:
(add-to-list 'custom-theme-load-path
             (file-name-as-directory "~/.emacs.d/themes/"))
  • Load the theme on your Emacs init file:
(load-theme 'cobalt t t)
(enable-theme 'cobalt)
  • Finally, save the Emacs init file and load it:
M-x eval-buffer

Here is a screenshot of how the Cobalt theme looks like on Emacs:

Cobalt Theme in Emacs

Until next time, have an awesome coding fun!