Emacs: How to Set a Color Theme

, , …,

This page shows you how to set emacs to use color themes.

Simple Setting of Background Color

You can set the background color. For example, call set-background-color then type “honeydew”.

Call list-colors-display to see available colors.

For permanent setup, put the following in your emacs init file.

;; set background of current window (emacs's “frame”) to pale tinge
(set-background-color "honeydew")
;; set all windows (emacs's “frames”) to some defaults
(setq initial-frame-alist '((width . 100) (height . 54)))
(setq default-frame-alist
      '((menu-bar-lines . 1)
        (left-fringe)
        (right-fringe)
        (tool-bar-lines . 0)
        (width . 100)
        (height . 52)
        ))
;; set all windows (emacs's “frame”) to use font DejaVu Sans Mono
(set-frame-parameter nil 'font "DejaVu Sans Mono-10")

For detail, see: Emacs: How to List & Set Font.

The DejaVu font is the best font for Unicode. It's installed on Linux. On Windows or Mac, you can download it. See Best Unicode Fonts for Programing.

Simple White on Black, Reverse Video

Sometimes, under bright sunlight, it's better to have black background. You can start emacs with emacs --reverse-video.

Emacs 24 Color Themes

Emacs 24 comes with color themes. To activate, call load-theme, then press Tab ↹ to show a list of available themes.

You can also call customize-themes.

To clear theme, call disable-theme.

Here's list of emacs 24.3 themes.

adwaita
deeper-blue
dichromacy
light-blue
manoj-dark
misterioso
tango
tango-dark
tsdh-dark
tsdh-light
wheatgrass
whiteboard
wombat
emacs color theme misterioso 2012-10-12-2
emacs color theme misterioso

Set a Color Theme Permanently

To set it permanently, put this in your emacs init file.

(load-theme 'misterioso)

Get More Color Themes

For more themes choices, you can install the package “color-theme”. It's in MELPA repository. 〔☛ A Guide on Emacs 24 Package System

After you install it, call color-theme-select. It'll list themes. Move cursor and press Enter ↵ to apply. (you can also call describe-variableF1 v】 then “color-themes” to see a list of available themes. For example, one of them is color-theme-classic. These are elisp commands.)

To make it permanent, you can set in your emacs init this:

(package-initialize)
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-classic)

Thanks to Gabriel Saldaña, Torsten Wagner, Steve Purcell for tips.

blog comments powered by Disqus