How can I apply a color-scheme (.el file) in emacs?

I have downloaded zenburn.el that is a color-scheme for Emacs, but I don´t know how I can apply it to emacs. I am a beginner in emacs.

How do I apply my .el file to emacs? Can I do some linking from my .emacs-file?

I am using emacs23 on Linux Mint 8.

I have now installed color-theme with

sudo apt-get install emacs-goodies-el

But I don't get Zenburn when I start emacs, and there is no Zenburn when I do M-x color-theme-<TAB> <RETURN> in emacs.

This is my .emacs

(tool-bar-mode -1)

(add-to-list 'load-path "/home/sanoj/zenburn.el")
(require 'color-theme)
(load 'zenburn)  ;; requires that zenburn.el is in your load path
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-zenburn)))

Solution 1:

You need to load color-theme and initialize with something like this:

(add-to-list 'load-path "/path/to/color-theme.el/file")
(require 'color-theme)
(load 'zenburn)  ;; requires that zenburn.el is in your load path
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-zenburn)))

If your distribution of emacs doesn't already have color-theme installed, you'll need to download it first from http://www.nongnu.org/color-theme/

Solution 2:

I'm an emacs newbie; but with emacs 23.2.1 on Vista, I got this by adding the following lines. I also had to name the file as ~/.emacs.d/zenburn-theme.el.

(require 'color-theme)
(load-theme 'zenburn)
(color-theme-zenburn)

Solution 3:

Most of your code is boilerplate code from color-theme installation guide so should work fine. Look at the things that are different.

(add-to-list 'load-path "/home/sanoj/")
(require 'color-theme)
(require 'zenburn)
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-zenburn)))

Your add-to-list must take a DIRECTORY name as an argument, that's your first mistake. Also, you mustn't load zenburn, you must require it.

I just checked it on my emacs 23 on Arch and it works!