emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color themes


From: Chong Yidong
Subject: Re: Color themes
Date: Sun, 09 Aug 2009 12:18:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Leo <address@hidden> writes:

> I also don't like color-theme, in particular, how the themes are created
> by re-defining all faces. A comprehensive theme could easily run up to a
> few thousand lines and it still does not offer 100% coverage, let alone
> consistency.
>
> Perhaps a color theme should be defined to be something like a palette
> and when a palette is selected defface is forced to only use colors in
> it.

This is exactly the kind of problem that Custom themes is intended to
solve.  The code for *creating* custom themes is still a little buggy,
but the code for *using* it should work, and we ought to be able to make
use of it to set color themes.

Here's an example.  Create a file called forest-theme.el, with the
contents shown below, and put it in .emacs.d.  Then do M-x enable-theme
RET forest RET, or customize custom-enabled-themes and add `forest' to
the list.

So if we want to use this mechanism to implement color themes, it's just
a matter of adding some *-theme.el files to the load path, and adding a
command to add that theme to custom-enabled-themes.

As you can see, (i) your existing face customizations, if any, will
override the color theme, as they should, and (ii) it doesn't take a lot
of code to define a color theme using this method.


======= start forest-theme.el ============

(deftheme forest
  "Created 2009-08-09.")

(custom-theme-set-faces
 'forest
 '(default ((t (:foreground "wheat" :background "black"))))
 '(font-lock-comment-face ((((class color) (min-colors 88)) (:foreground 
"medium sea green"))))
 '(font-lock-constant-face ((((class color) (min-colors 88)) (:foreground 
"turquoise"))))
 '(font-lock-function-name-face ((((class color) (min-colors 88)) (:foreground 
"pale green"))))
 '(font-lock-keyword-face ((((class color) (min-colors 88)) (:foreground 
"white"))))
 '(font-lock-string-face ((((class color) (min-colors 88)) (:foreground "dark 
khaki"))))
 '(font-lock-type-face ((((class color) (min-colors 88)) (:foreground "medium 
aquamarine"))))
 '(font-lock-variable-name-face ((((class color) (min-colors 88)) (:foreground 
"yellow green"))))
 '(font-lock-warning-face ((((class color) (min-colors 88)) (:foreground 
"salmon1"))))
 '(font-lock-builtin-face ((((class color) (min-colors 88)) (:foreground 
"LightSteelBlue"))))
 '(region ((((class color) (min-colors 88)) (:foreground "white" :background 
"dark green"))))
 '(highlight ((((class color) (min-colors 88)) (:foreground "white" :background 
"dark green")))))

(provide-theme 'forest)

======= end forest-theme.el ============




reply via email to

[Prev in Thread] Current Thread [Next in Thread]