emacs-devel
[Top][All Lists]
Advanced

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

Re: Color themes


From: Leo
Subject: Re: Color themes
Date: Mon, 10 Aug 2009 10:12:38 +0100

2009/8/9 Chong Yidong <address@hidden>:
> 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 ============

Thank you Chong.

I failed to see how consistency can be reached through this.

For example, if a package define faces that do not inherit from the
faces in the theme, then enabling the theme won't affect them, right?

I am thinking about if each buffer is an icon, how to make sure they
look like, for example, tango by using the 28 colors in its style
guide only.

Leo




reply via email to

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