[Top][All Lists]
[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:11:06 -0600 |
User-agent: |
Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux) |
(patches? we don't need no steenkin' patches!)
=== modified file 'doc/lispref/display.texi'
--- doc/lispref/display.texi 2011-01-31 23:54:50 +0000
+++ doc/lispref/display.texi 2011-03-10 19:03:48 +0000
@@ -2057,6 +2057,21 @@
black-and-white displays, certain shades of gray are implemented by
stipple patterns.
+You may want to set the foreground automatically in some cases using
+the @code{color-complement} and @code{color-rgb-to-hex} functions from
+the @code{color.el} library. Here's an example:
+
address@hidden
+(defface myface
+ (let ((color "red"))
+ `((((class color) (background light))
+ (:foreground ,color))
+ (((class color) (background dark))
+ (:foreground ,(apply 'color-rgb-to-hex (color-complement color))))
+ (t nil)))
+ "My face.")
address@hidden example
+
@item :background
Background color, a string. The value can be a system-defined color
name, or a hexadecimal color specification. @xref{Color Names}.