(redirected from ColorTheme)


This page is about color themes and custom themes.

EmacsLisp library color-theme.el provides many predefined color themes for your use, and you can easily define additional themes. For questions about color-theme, see ColorThemeQuestions. The library has not been updated recently, but you can use it with any Emacs version since at least Emacs 20 (through at least Emacs 24). See the color-theme web page at http://www.nongnu.org/color-theme for how to get started with color-theme.el.

Starting with version 23, vanilla GnuEmacs introduced custom themes, which are similar to color themes. Emacs 24 added a Customize interface for custom themes.

Custom themes are similar to color themes, but:

Installing Library Color Theme

[See http://www.nongnu.org/color-theme for the latest information.]

Put the file color-theme.el and the folder “themes” (with the files color-theme-example.el and color-theme-library.el) in a directory on your LoadPath. The main function to use is ‘color-theme-select’. It creates the Color Theme Selection buffer that allows you to test the themes before choosing one.

M-x load-library RET color-theme RET M-x color-theme-select RET

The easiest way is to install a chosen color theme is to require the file and call the appropriate color theme function. Put the appropriate code in your .emacs file:

    (require 'color-theme)

If it doesn’t seem to work, try adding one more line:

   (require 'color-theme)
   (setq color-theme-is-global t)

If you like putting globals in default.el and local customizations in .emacs then, add the require to default.el and use this in .emacs

     (eval-after-load "color-theme" '(color-theme-robin-hood))

Use the `?’ in the Color Theme Selection buffer to find the name of the appropriate color theme function.

If the colors seem to get reset (such as background color changing to white on startup or when creating a new frame), consider checking ColorsAndKde.

If on loading emacs, you get an error like

     Debugger entered--Lisp error: (wrong-type-argument keymapp nil)
     define-key(nil [menu-bar Tools] ("Tools" keymap "Tools"))

Change lines 589 and 590 in color-theme.el to:

     (easy-menu-add-item nil '("tools") "--")
     (easy-menu-add-item  nil '("tools")
                     ["Color Themes" color-theme-select t])

Note the “tools” vs “Tools”.

Choosing a Color Theme from a Menu

Choosing a color theme by name is only convenient if you already know what color scheme a given name represents. After installing Color Theme, you can pick and choose from a menu. This menu can be accessed via ‘M-x color-theme-select’.

Choosing a Color Theme or Custom Theme by Cycling

An alternative way to choose a theme is to cycle among a set of themes, applying each in turn, and stop when you find one you like – WYSIWYG.

Here are four alternative ways to cycle among color themes in a list. For illustration, they all use the same list.

  (require 'color-theme)
  (setq my-color-themes (list 'color-theme-billw 'color-theme-jsc-dark 
                              'color-theme-sitaramv-solaris 'color-theme-resolve
                              'color-theme-classic 'color-theme-jonadabian-slate
                              'color-theme-kingsajz 'color-theme-shaman
                              'color-theme-subtle-blue 'color-theme-snowish
                              'color-theme-sitaramv-nt 'color-theme-wheat))

Do Re Mi: Cycling Color Themes and Custom Themes

You can cycle among color themes or custom themes using library DoReMi. This feature is part of library doremi-cmd.el.

Use command `M-x doremi-color-themes+’ or `M-x doremi-custom-themes+’, then use the up and down arrow keys and/or the mouse wheel to cycle among themes. The name of each newly applied theme is displayed in the echo area. You can customize options ‘doremi-color-themes’ and ‘doremi-custom-themes’, which is the set of color or custom themes to cycle among. By default, all color or custom themes are included.

You can use these commands to preview themes: use ‘C-g’ to cancel changes and return to what you had before.

Also worth mentioning, if you define your own themes, are the commands in library doremi-frm.el that let you fine-tune frame and face colors incrementally, using the arrow keys or mouse wheel. They give you an easy way to get exactly the color scheme you want before saving it as a color theme. There are also commands to convert and tweak colors (for example, obtain a color that is slightly lighter, redder, etc. than a given color). See Do Re Mi.

Icicles: Completion and Cycling of Color Themes and Custom Themes

You can use Icicles command ‘icicle-color-theme’ or ‘icicle-custom-theme’ to cycle among color themes or Emacs custom themes, respectively. This functionality is similar to that provided by DoReMiColorThemes (above), but you can also complete the color-theme names, which means also that you can narrow the set of themes that you cycle among. (You can also sort the set in various ways.)

Just as for the corresponding DoReMi commands, ‘C-g’ undoes your changes. Options ‘icicle-color-themes’ and ‘icicle-custom-themes’ are similar to options ‘doremi-color-themes’ and ‘doremi-custom-themes’, respectively – customize them to define the lists of themes to choose from (default: all themes). See Icicles.

Cycling by Repeating a Command

Repeat command ‘my-theme-cycle’ (bound here to `[F12]') to cycle among themes.

    (defun my-theme-set-default () ; Set the first row
      (setq theme-current my-color-themes)
      (funcall (car theme-current)))
    (defun my-describe-theme () ; Show the current theme
      (message "%s" (car theme-current)))
   ; Set the next theme (fixed by Chris Webber - tanks)
    (defun my-theme-cycle ()		
      (setq theme-current (cdr theme-current))
      (if (null theme-current)
      (setq theme-current my-color-themes))
      (funcall (car theme-current))
      (message "%S" (car theme-current)))
    (setq theme-current my-color-themes)
    (setq color-theme-is-global nil) ; Initialization
    (global-set-key [f12] 'my-theme-cycle)

(note: Make the following changes to allow this code to work when (setq my-color-themes color-themes). )

    (defun car-theme () ;figure out if we need car or caar
       ((consp (car theme-current))
        (caar theme-current))
        (car theme-current))))
    (defun my-theme-set-default () ; Set the first row
      (setq theme-current my-color-themes)
      (funcall (car-theme)))
    (defun my-describe-theme () ; Show the current theme
    (message "%s" (car-theme)))
    ; Set the next theme (fixed by Chris Webber - tanks)
    (defun my-theme-cycle ()		
    (setq theme-current (cdr theme-current))
    (if (null theme-current)
        (setq theme-current my-color-themes)
        (funcall (car-theme)))
    (message "%S" (car-theme)))
    (setq theme-current my-color-themes)
    (setq color-theme-is-global nil) ; Initialization

Installing a Color Theme for One Buffer Only

On GNU Emacs featuring Face-Remapping (that is versions >= 23) you can use color-theme-buffer-local to install theme faces on a per buffer basis.

Here’s how to do this interactively.

   M-x color-theme-buffer-local

Or you can use it programmatically to install a color theme based on a major mode, for example:

   (require 'color-theme-buffer-local)
   (add-hook 'java-mode 
     (lambda nil (color-theme-buffer-local 'color-theme-robin-hood (current-buffer))))

Installing a Color Theme for One Frame Only

You can do this by using the variable ‘color-theme-is-global’ which determines whether a color theme is installed on all frames or not. Here’s how to do this interactively.

    M-x set-variable RET color-theme-is-global nil
    M-x color-theme-blue-sea

A possible use for this variable is dynamic binding. Here is a larger example to put in your ~/.emacs; it will make the Blue Sea color theme the default used for the first frame, and it will create two additional frames with different color themes.

    (require 'color-theme)
    ;; set default color theme
    ;; create some frames with different color themes
    (let ((color-theme-is-global nil))
        (select-frame (make-frame))
        (select-frame (make-frame))

Installing a color Theme Depending on the Display

Use display-color-cells find how many colors are supported. Note that on X, even though all RGB values are supported, each application gets allocated a number of colors it may use. Perhaps that is the reason the function returns 64 on my system even though it seems that it supports a lot more.

    (if ((display-color-cells) 20)

Installing a Color Theme Depending on the Window System

Use ‘window-system’ to determine whether or not you are in a terminal, or a windowing system such as X11.

    (if window-system

‘window-system’ is nil for a character-based terminal, ‘x’ for X11, ‘mac’ for mac, etc.

Fixed: The (window-system) to window-system since it’s a variable and not a function shouldn’t have the ().

Question: Any idea how to detect if emacs has been started as a daemon? I think we need logic like:

    (if window-system or started-as-daemon

The following code in your .emacs file will test whether each frame is opened in a GUI or console and select according to the colors you select for each in the variable, color-theme-choices (based on the comments by Pierre on Emacs-Fu):

    ;; select theme - first list element is for windowing system, second is for console/terminal
    (setq color-theme-choices '(color-theme-deep-blue color-theme-standard))
    ;; test for each frame or console
    (require 'cl)	
    (lexical-let ( (cols color-theme-choices) )
      (defun test-win-sys (frame)
        (let ( (color-theme-is-global nil) )
          (select-frame frame)
          (eval (append '(if (window-system frame)) 
     		    (mapcar (lambda (x) (cons x nil)) cols))))))
    ;; hook on after-make-frame-functions
    (add-hook 'after-make-frame-functions 'test-win-sys)

Installing a Color Theme with multi-tty

I want a color theme to be selected any time I open an X frame, but not when I open a TTY frame. With multi-tty, this is selected on a frame-by-frame basis. So I use a hook:

 (add-hook 'after-make-frame-functions
           (lambda (frame)
             (set-variable 'color-theme-is-global nil)
             (select-frame frame)
             (if window-system

Changing Fonts

Usually the color themes don’t change fonts. Please let me know if they do. That is a bug. If you want to install a color-theme and then switch font-family and font-size to something new, here is an example of how to do it:

    (let ((spec '((t (:family "neep alt" :height 200)))))
        (mapc (lambda (face)
            (face-spec-set face spec)
            (put face 'face-defface-spec spec))
            '(default menu)))

If you use ‘set-face-font’ instead, you will note that on subsequent frames, your settings may not take effect. (Actually I haven’t really investigated this.)

It seems that some color-theme-* function destory the ‘default face font when the ‘default face uses fontset specification. In other words, (face-attribute ‘default :font) is not preserved. To handle this, insert following macro in your code:
        (defmacro save-font-excursion (face &rest body)
          "Save the :font property of given FACE during the execution of BODY."
          (declare (indent 1) (debug t))
          `(let ((oldfont (face-attribute ,face :font)) ret)
             (setq ret (progn ,@body))
             (or (string= oldfont (face-attribute ,face :font))
                 (set-face-attribute ,face nil :font oldfont))
And, try something like:
      (save-font-excursion 'default
Note that if you do not use fontset spec, save-font-excursion helps less. – CinSK

Mix and Match

Take a look at ColorThemeMaker.

Color Theme Session

Following code will allow you to setup a mechanism of saving and retrieving the last session’s settings. This depends on two files in your home directory, .themesettings and .curTheme. The first is just an elisp file which is loaded when Emacs starts. It is primarily used for two settings: theme-default and theme-load-from-file.

Example 1:

    (setq theme-load-from-file t)

Example 2:

    (setq theme-default 'color-theme-gnome2)

This always loads the default theme you provided. Add the following code to your ~/.emacs. This assumes that you have (require ‘color-theme) somewhere before that:

    (defun my-onload()
        (setq filename (concat (expand-file-name "~") "/.themesettings"))
    (if (file-exists-p filename)
            (load-file filename)
            (if (equalp theme-load-from-file t)
                    (setq filename 
                        (concat (expand-file-name "~") "/.curTheme"))
                    (if (file-exists-p filename)
                            (message "selecting theme from .curTheme")
                            (load-file filename)
                            (color-theme-install (my-color-theme))
                (funcall theme-default)
        (message "selecting theme from color-theme-standard")
    (defun my-kill-saves()
        (if (equalp theme-load-from-file t)
                (write-file (concat (expand-file-name "~") "/.curTheme"))
    (add-hook 'after-init-hook 'my-onload)
    (add-hook 'kill-emacs-hook 'my-kill-saves)

Please note that I have used this only on XEmacs. --GirishB

The above code should change the filenames to be in one place and give some indication of what the files are for. Otherwise a year later you will be scratching your head trying to figure out what program put those files there. Try sticking them in a directory like ~/.my-emacs-extensions. If you don’t believe that this is important, look at your home directory and tell me what program put each file there! – gadfly

Having the Color Theme Selection buffer always present

Put the following lines to your ~/.emacs file:

    (load-library "color-theme")

Assuming you have color-theme package in load-path.

Day/night toggling

You can switch to dark mode and back again with the following in your ~/.emacs:

    (defun toggle-night-color-theme ()
      "Switch to/from night color scheme."
      (require 'color-theme)
      (if (eq (frame-parameter (next-frame) 'background-mode) 'dark)
          (color-theme-snapshot) ; restore default (light) colors
        ;; create the snapshot if necessary
        (when (not (commandp 'color-theme-snapshot))
          (fset 'color-theme-snapshot (color-theme-make-snapshot)))
    (global-set-key (kbd "<f9> n") 'toggle-night-color-theme)

The function assumes that default ‘background-mode’ is ‘light’. You may wish to modify the name of [dark] theme and the key binding.

Day/night toggling based on time of day

You can also automatically change your color theme based on the time of day using theme-changer.el. In your ~/.emacs, make sure your location is set:

    (setq calendar-location-name "Dallas, TX") 
    (setq calendar-latitude 32.85)
    (setq calendar-longitude -96.85)

And then specify the day and night color themes:

    (require 'theme-changer)
    (change-theme 'color-theme-solarized-light 'color-theme-solarized-dark)

Note: you may need to add the theme-changer.el path to your loadpath. For example:

    (add-to-list 'load-path "~/.emacs.d/elisp/theme-changer")

More Color Themes

High contrast zenburn theme: hc-zenburn-emacs – edran

I added my tweaked port of ColorThemeInkpot from VIM. – Per Vognsen

DanielBrockman links to another color-theme on his page. I will add it for the next release. – zeDek.

I’ve put an updated version of DanielBrockman’s theme (’zenburn’) on the wiki: ColorThemeZenburn.

I’ve posted the latest revision of color-theme-hober2; it’s quite a bit more fleshed out from when I submitted it to you. – EdwardOConnor

Here’s my DarkVee color theme – vic

Alex rose to the Hello Kitty challenge and wrote PinkBliss.

I’ve attempted to clone the Blackboard theme from textmate here – JD Huntington

I have created a color theme based on Tango Palette. Lisp:color-theme-tango.el (screenshot) – danran

The Empty Void - A dark theme that I created for myself, with subtle shades; easy on the eyes.

I created a color theme based on your color-theme-tango.el. I modified it a bit and added some faces for Gnus, org-mode, customize buffers, etc. You can find screenshots and installation instructions here : https://github.com/juba/color-theme-tangotangoJulienBarnier

I’ve created color-theme-dirac, a nice (for me) pastel color theme on black background. It’s available via git at http://github.com/nicodds/color-theme-dirac (screenshot) – Domenico Delle Side

I have created a color theme based on the TextMate Mac Classic theme. It’s stored in a git repo via http://github.com/jbw/color-theme-mac-classic along with a screenshot and install instructions. --jbw

A port of VIM’s desert theme can be found here. Any comments / suggestions are welcome! – superbobry

Live color theme screenshots at the (color-theme-select) web site (almost ~130 themes) – vic

Bill Clementson has published his color theme: http://bc.tech.coop/ubuntu-config/elisp/color-theme-billc.el

Pomgranate Explosion, an elegant and soft color theme for GNU Emacs. Available at https://github.com/bmarcot/color-theme-pomgranate-explosion.

monokai-theme.el is based on TextMate’s monokai theme. Can anybody make it Emacs 24 deftheme and package.el compatible?

My take on Monokai for emacs: https://github.com/stafu/AnotherMonokai – SM

Color theme I use daily. It’s highly contrast black-purple theme. Lisp:color-theme-black-purple.el – Anonymous


The original color theme code was written by Jonadab the Unsightly One.

Installing a Random Color Theme

Put this in your ~/.emacs:

    (funcall (car (nth (random (length color-themes)) color-themes)))

Saving a Color Theme in .Xresources

Given the name of a color theme, write out the .Xresources equivalent of the theme. You would want to do this if you want to make Emacs start much faster than loading the theme from Lisp.

Example usage:

    M-x color-theme-x RET hober RET
    C-u M-x color-theme-x RET classic RET ~/elisp/color-theme.el RET

After the generated X resource settings have been written out to your .Xresources file, you’ll need run either xrdb -merge .Xresources or xrdb -load .Xresources (depending on the desired effect). You will have to restart your Emacs to have the new X resources take effect.

Using GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2) of 2009-11-01 on raven, modified by Debian, I’m not able to use properly that package. It loads fine, but when I’m invoking one of the example commands, I get the following error message: ‘assoc: Wrong type argument: listp, color-theme-classic’, and the buffer color-theme-xresources is practically empty. Am I doing something wrong? – MathieuBasille?

I’ve forked and updated color-theme-x.el. It’s available in Marmalade and on GitHub – AndrewJohnson?

Saving a Color Theme in the Windows Registry

Lisp:color-theme-reg.el – convert color-theme to win32 reg. by Kyle M. Lee, based on color-theme-x.


The problem is that the current version does NOT support multiple inherited properties. A quick workaournd has been sent to David for testing purpose. As it is quite ugly and doesn’t handle Xemacs, I won’t post it here before working on it again. Please David, tell us if that worked for you. – XavierMaillard

Any ideas what to do about this?

I’ve seen similar problems on Windows where somehow the cursor color was always wrong for the first frame. I solved this by creating a new frame and deleting the old one in my .emacs on Windows. – AlexSchroeder
Solved the problem by loading viper-mode after the color-theme call. That seems to fix the problem. It seems like viper basically remembers the last cursor color it knew and forces it down your throat no matter what. – GirishB
I reported that bug in May 2006. It has been fixed recently in Emacs 22. See the thread “cursor-color frame parameter cannot equal background-color” in emacs-pretest-bug@gnu.org. This has nothing to do, per se, with color themes, BTW. – DrewAdams
  • Frame creation is slowed down a lot - it takes seconds to create a new frame when i’ve applied different color-themes before. The reason seems to be that a myriad of faces is defined, because each color themes defines some 50 faces, and they never get removed before a new face is applied. You can easily end up with 600 faces defined, and Emacs needs a lot of time to go through all of them when it creates a new frame. Has anyone experienced similar issues? – DavidReitter
  • I get “Wrong type argument: symbolp, (link-visited info-xref)” with 2006-05-13 CVS emacs, with 2006-05-14 CVS color-theme.el. It isn’t fixed by the other ‘symbolp’ fix, which is already included in the CVS. Any suggestion?
    • I installed the CVS version of color-theme which fixed this (Emacs/22.0.92). - springfield
  • New version of color-theme (6.5.4) doesn’t work with stable emacs version (21.4). Users will see this error:

<code>color-theme-backup-original-values: Symbol’s function definition is void: color-theme-filter</code>

To fix the problem, open color-theme.el and change:

 <code>easy-menu-get-map(nil ("Tools") nil)
 easy-menu-add-item(nil ("Tools") "--")</code>


 <code>easy-menu-get-map(nil ("tools") nil)
 easy-menu-add-item(nil ("tools") "--")</code>

Original help.gnu.emacs post: http://tinyurl.com/bgke3


This issue is fixed in the CVS.

I am running Ubuntu 6.06 (Dapper Drake) and emacs-snapshot seems to not play well with color-theme. When it loads, only the characters have the correct background color. The rest of the buffer has some default gray color. Emacs21 seems to work just fine. Has anyone else seen this? Any idea how to fix it?

Check out the ColorsAndKde page.


Themes for console/tty Display

How can I filter the themes to find those suitable for console/tty? Recently I’ve been using GNU Screen and naturally my X Windows faces don’t work. Ediff is especially limited 😟.

Screen supports 256 colors. It’s a compile-time option disabled by default in Debian and Ubuntu packages. – TrentBuck

This hasn’t been the case since 2007. 4.0.3-5 onward include 256 color support, which means Etch and Dapper, respectively, were the last releases to have non-256 color support in screen.

I suggest you use no theme at all. Most themes are not designed to degrade gracefully. They all use a spec that says “for all display types”. So you have to rely on the fall-back mechanism that reduces millions of colors to 16. Not good. All of themes I know except for retro orange or retro green look terrible on a 16 color terminal. Have you tried running on a 256 color terminal? Might be a bit better. – AlexSchroeder

It may still be desirable to filter for themes designed for those 256 color themes; 256 color ttys will still degrade themes designed for a 24-bit display.

Bugs and caveats

Unfortunately, nothing here says where the bug tracker is (found it!), so I can’t report anything there. Should you happen to blow the stack trying to do color-theme-select, you might want to try this patch, which detects and suppresses such infinite recursions: https://gist.github.com/1259919

It happened to me because of https://github.com/dbrock/zenburn-el/issues/13

Installing ColorTheme (from tar.gz file)

After downloading the tar.gz file, there’s a Makefile, a README, and a number of other files, but no instructions for Joe User on how to install. If you’re simply a user who wants to have the color themes installed, I believe you are to ignore the Makefile, and simply copy color-theme.el and the themes directory to a directory on your load-path (say, [[.emacs.d?]]).

. Thank you. It will be part of 6.6.1 – XavierMaillard

Choosing a new theme resizes the frame

I am running 6.6.0 with the Carbon XEmacs port of 21.5.beta27. Whenever I choose a new theme, it resizes my frame to 80x40. – doktorstick

Cursor faces are OS dependent (fixed in v24)

Just a note that after spending several hours trying to figure out why a color-theme wasn’t displaying the text under the cursor correctly for me on OSX, it appears according to the people on the emacs irc channel that the cursor is controlled by the operating system. Under OSX, apparently the foreground color cannot be adjusted. If you change this value within emacs you won’t see the result reflected as it will be ignored. It appears to work fine under Windows and Linux. The issues with OSX were noticed using OSX 10.6 and 10.7. This is not an issue with color-theme as such, but I just wanted to highlight it here also since I ran into this issue while trying to use color-theme and wasted several hours on it. I hope others won’t do the same. – Josh

Edit: The cursor colors function correctly with gnu emacs for osx v24, so they appear to have fixed whatever prevented it working with earlier versions. – Josh


To have an idea of what a theme looks like, I think we could all take a screenshot of our prefered and running theme.

If you want to help (as there are many themes now and still more pending), you can send me a big (png only) screenshot accompanished with a thumb of reasonable size (ie. 400x300). I will then build an online gallery and maybe add them to the ColorTheme package.

For theme creators, I would appreciate now if you could join a screenshot of your theme when you submit it to me.

Send them to me at : zedek (at) gnu.org

MaverickWoo has compiled one such gallery at http://code.google.com/p/gnuemacscolorthemetest/. We now have another gallery on http://www.flickr.com/groups/emacs/. Please share your screenshots.

You can use the (color-theme-select) web site to preview many color themes ~130, and create your own. – vic

Future Plans


CategoryFaces CategoryCustomize