unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@glug.org>
Subject: Re: a better face for your eyes
Date: Fri, 31 Mar 2006 22:20:00 +0200	[thread overview]
Message-ID: <7e7j6atlhr.fsf@ada2.unipv.it> (raw)
In-Reply-To: 442d7fc0$1_1@news.iprimus.com.au

"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

  reply	other threads:[~2006-03-31 20:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-01 14:14 a better face for your eyes Gary Weselle
2006-03-31 20:20 ` Thien-Thi Nguyen [this message]
2006-04-01 20:14   ` Gary Weselle
2006-04-01  1:47     ` Drew Adams
2006-04-03  7:28     ` Bastien
2006-04-04  1:34       ` Rares Vernica
2006-04-04 22:20       ` Xavier Maillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e7j6atlhr.fsf@ada2.unipv.it \
    --to=ttn@glug.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).