Weblog entry #38 for Steve

Setting up emacs colours with emacs-color-themes
Posted by Steve on Sun 23 Oct 2005 at 15:51
Tags: none.

I'm not sure if this is worthy of an article in its own right, so a weblog. To help me remember.

Emacs has a lot of facilities for customization so much so that people can often get confused. When it comes to colour selection though there is a really simple method which allows you to use different "themes". This is provided by the emacs-color-themes package.

Install it with:

apt-get install emacs-color-themes

(If you're running Woody, or Sarge, the package is not available. You can find a backported emacs-color-themes for Sarge here.)

Now that you've installed the package you should add the following to the file ~/.emacs (creating it if it is not present):

(require 'color-theme nil t)

This will load the library (and not give errors if loading fails - useful if you share the .emacs file across hosts like I do)

Now that it is loaded you can run emacs and then run:

M-x color-theme-select

(Press "[Escape] x color-theme-select [return]")

This will display a list of theme names to the left, along with a list of author name & email addresses to the right. Simply click upon the theme name in the left, or move down with the arrow keys and press return. The selected theme will be previewed.

Once you've found one you like you can make it permanent by editting your .emacs file again.

For example if you prefer the theme "Blue Mood" you can add:

(if (require 'color-theme nil t)
    (color-theme-blue-mood))

(Here we've changed the first line so that only if the package was loaded correctly do we set the theme.)

One last tip, (and this is what I always forget), is that you can setup different themes for X11 usage and console usage.

The magic recipe is:

;; Setup a nice theme if we have the color-theme package loaded.
;; Use different themes for console and X11 usage.
(if (require 'color-theme nil t)
    (if window-system
	(color-theme-gnome2)    ;; For use within X11
      (color-theme-arjen)))     ;; For console use

 

Comments on this Entry

Posted by Anonymous (83.89.xx.xx) on Mon 24 Oct 2005 at 12:48
Is there an easy way to save your current theme and share it?

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Mon 24 Oct 2005 at 13:10
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Sadly I don't know ... but the EmacsWiki might have some clues, or point you in the right direction.

Steve
--

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search