emacs-devel
[Top][All Lists]
Advanced

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

Re: color-complement for defface


From: Ted Zlatanov
Subject: Re: color-complement for defface
Date: Thu, 10 Mar 2011 13:09:05 -0600
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

On Sun, 20 Feb 2011 18:44:04 +0100 Julien Danjou <address@hidden> wrote: 

JD> Here's a very simple example on how to use it:
JD> #+begin_src: emacs-lisp
JD> (defface myface
JD>   (let ((color "red"))
JD>     `((((class color) (background light))
JD>        (:foreground ,color))
JD>       (((class color) (background dark))
JD>         (:foreground ,(apply 'color-rgb->hex (color-complement color))))
JD>       (t nil)))
JD>   "My face.")
JD> #+end_src

A patch that shows how to do this in lispref/display.texi is attached.
I put it under the :foreground property documentation for `defface' but
it's right next to the :background property too, so it should be obvious
to a reader how to use it to do the opposite, setting the background to
a complement.

JD> Obviously, a new function/macro could be created to automate this use of
JD> color-complement.

The :foreground and background properties can only be a string
currently, so it may be even simpler to allow them to be the form
(complement "color-string").  That should be a clean extension.  If not,
I guess a function or a macro could do it too.

Ted




reply via email to

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