[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a better face for your eyes
From: |
Thien-Thi Nguyen |
Subject: |
Re: a better face for your eyes |
Date: |
Fri, 31 Mar 2006 22:20:00 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Gary Weselle" <weselle_g@hotmain.com> writes:
> Any body with a better solution.
there are many "themes" packages, some quite fancy. below is a simple
one. i load this on startup, and call `set-theme' from ~/.emacs, which
is early enough to make the mysterious (to me) font-lock machinery DTRT
for things like `font-lock-function-face', etc. back when i was loading
it later in the session, sometimes font-lock would make disturbing color
choices.
thi
_________________________________________________
;;; set-theme.el
;;;
;;; Rel:v-1-55
;;;
;;; Copyright (C) 2000,2002,2003,2004,2006 Thien-Thi Nguyen
;;; This file is part of ttn's personal elisp library, released under GNU
;;; GPL with ABSOLUTELY NO WARRANTY. See the file COPYING for details.
;;;
;;; Description: Select an appearance configuration.
(defvar themes '(;;name bg fg m-fg m-bg (optional)
(classic-ttn \#a85 black white black)
(new-earthy black sienna gray30)
(zzzzzzzzzz black darkgreen black)
(caffeine black yellow white)
(polar white black white black)
(dream black cyan white blue)
(fuori-fuso black green magenta)
(vt220 black goldenrod gray30))
"List w/ elements of form:
\(NAME BACKGROUND FOREGROUND MODELINE-FOREGROUND [MODELINE-BACKGROUND]\)
If MODELINE-BACKGROUND is not specified, it defaults to BACKGROUND.
All elements are symbols. Use `\\#RGB' to specify a color using RGB
components.")
;;;###autoload
(defun set-theme (name)
"Select appearance configuration NAME. (See variable `themes'.)"
(interactive (list (completing-read "Theme: "
(mapcar 'list
(mapcar 'symbol-name
(mapcar 'car
themes)))
nil ;;; predicate
t))) ;;; require-match
(when (symbolp name)
(setq name (symbol-name name)))
(if (string= "" name)
(message "(%d themes, none chosen)"
(and
(describe-variable 'themes)
(length themes)))
(apply (lambda (bg fg m-fg &optional m-bg)
(set-face-foreground 'default fg)
(set-face-background 'default bg)
(let ((v [set-face-background set-face-foreground])
(i (if (face-inverse-video-p 'mode-line) 0 1)))
(funcall (aref v i) 'mode-line m-fg)
(funcall (aref v (- 1 i)) 'mode-line (or m-bg bg))))
(mapcar 'symbol-name
(cdr (assq (intern name) themes))))))
(provide 'set-theme)
;;; set-theme.el ends here