Surya
Surya

Reputation: 1187

Extend/Customize existing color-theme in emacs

Using emacs-24.1, how can we extend/customize existing color-theme in emacs ? I tried doing this

(custom-theme-set-faces
'tango
'(ido-first-match ((t (:foreground "008800" :weight bold))))

It worked fine when I had tango loaded. But when I put this in .emacs.d/init.el file, it failed because tango was not loaded by then and emacs complained of undefined tango. This certainly is not going to help as I tend to change theme regularly using (load-theme ...). What I'm looking at is some kind of hook to run when the theme is loaded. Is it possible ?

Ofcourse, I can modify tango-theme.el file but that is not my goal. I want to extend the existing theme. I tried this in my init file

(load-theme 'tango-dark)

    (custom-theme-set-faces
    'tango-dark
    '(ido-first-match ((t (:foreground "#00cdef" :weight bold))))

(deftheme tango)

    (custom-theme-set-faces
    'tango
    '(ido-first-match ((t (:foreground "#008800" :weight bold))))

This worked fine for tango theme.. But tango-dark is show the same color as tango. So, how to customize existing themes even before loading them or set the custom faces at the time of loading the theme.

Upvotes: 4

Views: 1096

Answers (2)

alinsoar
alinsoar

Reputation: 15783

When I want to define a new theme, I modify a given theme, and afterwards I call (color-theme-print). This function will generate a function that helps to restore my modified color theme.Put/include the generated function in .emacs.

color-theme-print is used to generate new color themes.

Upvotes: 2

Nicolas Dudebout
Nicolas Dudebout

Reputation: 9262

The command you are looking for is eval-after-load.

Upvotes: 1

Related Questions