Emacs: How to Set a Color Theme

Buy Xah Emacs Tutorial. Master emacs benefits for life.
, , …,

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)
        (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.

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. 〔➤ Emacs 24 Packages (ELPA) Tutorial

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:

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

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

Like it?
Buy Xah Emacs Tutorial
or share
blog comments powered by Disqus