[Top][All Lists]

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

Re: color-theme.el

From: Alex Schroeder
Subject: Re: color-theme.el
Date: Sun, 25 Aug 2002 15:38:57 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu)

Richard Stallman <address@hidden> writes:

>     May I also take this time to ask that color-theme.el be added to the
>     Emacs distribution.
> What does this do, and how can I talk with the author?

I am the author.  :)

Basically, it provides around 50 elisp functions that will change lots
of faces, frame-parameters, and variables, such as to change the look
of Emacs completely.

Since all 50 functions redefine lots of faces, the source file is VERY

~/WWW/home/tuning $ ls -l ~/elisp/color-theme
total 635
drwxrwxr-x   2 alex     alex         4096 Aug 10 20:58 CVS
-rw-rw-r--   1 alex     alex         4195 Apr 30 00:32 color-theme-maker.el
-rw-rw-r--   1 alex     alex       634752 Aug 10 20:57 color-theme.el
-rw-rw-r--   1 alex     alex       569761 Aug 25 15:31 color-theme.elc
-rw-rw-r--   1 alex     alex         3097 Sep  1  2001 make-theme.el

The color-theme-maker.el allows you to combine several color themes
into new themes, by example taking all faces definitions of faces
starting with "gnus-" from theme A and all other faces from theme B.

make-theme.el allows you to split the color-theme.el file
automatically into an "engine" and on file per theme function.  We
could make only the engine part of Emacs, and let people distribute
themes by themselves.

Here is a very short example -- my favorite theme.  It installs
color-theme-gnome2, and then it does some slight modifications.  It
also illustrates that many themes include faces for packages that are
not part of Emacs.  I would not go through the trouble of removing
these, since I depend on theme contributions by users.

(defun color-theme-robin-hood ()
  "`color-theme-gnome2' with navajo white on green."
  (let ((color-theme-is-cumulative t))
       ((foreground-color . "navajo white")
        (background-color . "#304020"))
       ((CUA-mode-read-only-cursor-color . "white"))
       (default ((t (nil))))
       (fringe ((t (:background "#003700"))))
       (header-line ((t (:background "#030" :foreground "#AA7"))))
       (ido-subdir-face ((t (:foreground "MediumSlateBlue"))))
       (menu ((t (:background "#304020" :foreground "navajo white"))))
       (modeline ((t (:background "dark olive green" :foreground "wheat"))))
       (semantic-dirty-token-face ((t (:background "grey22"))))
       (tool-bar ((t (:background "#304020" :foreground "wheat" :box 
(:line-width 1 :style released-button)))))
       (tooltip ((t (:background "lemon chiffon" :foreground "black"))))))))

The color theme selection buffer looks something like this:

    [Reset]                 Undo changes, if possible.
    [Quit]                  Bury this buffer.
    Aalto Dark              Jari Aalto <address@hidden>
    Aalto Light             Jari Aalto <address@hidden>
    Alice Blue              Girish Bharadwaj <address@hidden>
    Arjen                   Arjen Wiersma <address@hidden>
    Bharadwaj               Girish Bharadwaj <address@hidden>
    Billw                   Bill White <address@hidden>
    BlackOnGray             Sudhir Bhojwani <address@hidden>
    Blipp Blopp             Thomas Sicheritz-Ponten<address@hidden>
    Black                   Jonadab <address@hidden>
    Blue Mood               Nelson Loyola <address@hidden>
    Blue Sea                Alex Schroeder <address@hidden>
    Cheap Goldenrod         Alex Schroeder <address@hidden>


As you can see, we would need assignments by all the authors.  Since
their email addresses are part of the source, however, this should be
easy to get.


PS: Here is the commentary of color-theme.el.

;;; Commentary:

;; Sharing your current color setup:
;; Use `color-theme-submit'.  If you have already invested time in
;; customizing Emacs faces, please consider sharing your current setup.
;; Make sure that color-theme.el is in your `load-path'.  Type M-x
;; load-library RET color-theme RET to load all the functions.  Type M-x
;; color-theme-submit RET and mail the result to the maintainer of this
;; package (see above for mail addres).
;; If you want to make sure that all your customization was exported,
;; type M-x list-faces-display RET to get a list of all faces currently
;; defined.  This is the list of faces that `color-theme-print' uses.

;; Installing a color theme:
;; Make sure that color-theme.el is in your `load-path'.  Type M-x
;; load-library RET color-theme RET to load all the functions.
;; The main function to call is color-theme-select.  Type M-x
;; color-theme-select RET.  That creates a Color Theme Selection
;; buffer.  Press RET or `i' on a color theme to install it for the
;; rest of your session.
;; If you want to install the color theme as soon as Emacs is started
;; up, read the description of the theme you like and remember the
;; name of the color theme function.  Press `d' on a color theme in
;; the Color Theme Selection buffer to read the description.  Assuming
;; you like the Gnome2 theme, you'll find that the function to use is
;; called `color-theme-gnome2'.  Add the following to the end of your
;; .emacs (removing the leading `;;').
;; (require 'color-theme)
;; (color-theme-gnome2)

;; Changing menu colors:
;; In Emacs 21 on X, you can set the menu colors and font using the
;; menu face.  Example for your .emacs file:
;;   (set-face-font 'menu "7x14")
;;   (set-face-foreground 'menu "white").
;; If are using X, you can set the menu foreground and background using
;; a resource file, usually .Xdefaults or .Xresources.  Usually
;; .Xdefaults is used when you start your session using a display
;; manager such as xdm or gdm.  .Xresources is usually used when you
;; start X directly via a shell script such as startx.  If you set
;; Emacs*Background and Emacs*Foreground in such a resource file, the
;; foreground and background of Emacs including the menu will be set.
;; If your .emacs then loads a color theme, the foreground and
;; background are changed -- with the exception of the menu.  There is
;; no way to manipulate the menu foreground and background color from
;; elisp.  You can also set more specific menu resources for Emacs in
;; the resource file.  Here is a sample entry for your resource file:
;;   Emacs*Background:          DarkSlateGray
;;   Emacs*Foreground:          wheat

;; Creating your own color theme:
;; Use M-x customize-face and customize the faces.  Make sure to "Set
;; for Current Session" -- you don't want to save these using custom!
;; When you are done, call M-x color-theme-print to produce the elisp
;; code required to recreate your theme.  Better yet, use M-x
;; color-theme-submit to mail it to the maintainer.  That way it will be
;; added to future versions of color-theme.el.
;; For more information on the elisp format of a color theme, start with
;; the documentation of `color-theme-install' using C-h f
;; color-theme-install.
;; When your color theme is just a variation of an existing color theme,
;; take a look at `color-theme-robin-hood' in order to see an example of
;; how to do it.  Essentially you want to call all the parent color
;; themes before installing your changes.  For all but the first parent
;; color theme, you need to make sure that `color-theme-is-cumulative'
;; is bound to t.  If you don't do that, users that set
;; `color-theme-is-cumulative' to nil will only install your changes
;; without the parent color themes.

;; Making a color theme work for both Emacs and XEmacs:
;; The most important thing is to add missing faces for the other
;; editor.  These are the most important faces to check:
;; In Emacs                       In XEmacs
;; `font-lock-builtin-face'       `font-lock-reference-face'
;; `font-lock-doc-face'           `font-lock-doc-string-face'
;; `font-lock-constant-face'      `font-lock-preprocessor-face'
;; `modeline'                     `modeline-buffer-id'
;; `modeline'                     `modeline-mousable'
;; `modeline'                     `modeline-mousable-minor-mode'
;; `region'                       `primary-selection'
;; `region'                       `zmacs-region'
;; `font-lock-string-face'        `dired-face-boring'
;; `font-lock-function-name-face' `dired-face-directory'
;; `default'                      `dired-face-executable'
;; `font-lock-warning-face'       `dired-face-flagged'
;; `font-lock-warning-face'       `dired-face-marked'
;; `default'                      `dired-face-permissions'
;; `default'                      `dired-face-setuid'
;; `default'                      `dired-face-socket'
;; `font-lock-keyword-face'       `dired-face-symlink'
;; Further comments:
;; In Emacs 21 `modeline' is just an alias for `mode-line'.  I recommend
;; the use of `modeline' until further notice.
;; The support for :foreground and :background attributes works for
;; Emacs 20 and 21 as well as for XEmacs.  :inverse-video is taken care
;; of while printing color themes.
;; I don't recommend making font sizes part of a color theme.  Most
;; users would be surprised to see their font sizes change when they
;; install a color-theme.  Therefore, remove all :height attributes if
;; the value is an integer.  If the value is a float, this is ok -- the
;; value is relative to the default height.  One notable exceptions is
;; for a color-theme created for visually impaired people.  These *must*
;; use a larger font in order to be usable.
;; The tool-bar should not be part of the frame-parameters, since it
;; should not appear or disappear depending on the color theme.  The
;; apppearance of the toolbar, however, can be changed by the color
;; theme.  For Emacs 21, use the `tool-bar' face.  The easiest way to do
;; this is to give it the default fore- and background colors.  This can
;; be achieved using (tool-bar ((t (nil)))) in the theme.  Usually it
;; makes more sense, however, to provide the same colors as used in the
;; `menu' face, and to specify a :box attribute.  In order to alleviate
;; potential Emacs/XEmacs incompatibilities, `toolbar' will be defined
;; as an alias for `tool-bar' if it does not exist, and vice-versa.
;; This is done eventhough the face `toolbar' seems to have no effect on
;; XEmacs.  If you look at XEmacs lisp/faces.el, however, you will find
;; that it is in fact referenced for XPM stuff.
;; Similarly, the `fringe' face defines what the left and right borders
;; of the frame look like in Emacs 21.  To give them default fore- and
;; background colors, use (fringe ((t (nil)))) in your color theme.
;; Usually it makes more sense to choose a color slightly lighter or
;; darker from the default background.

reply via email to

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