help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: function to get inverse color name?


From: Emanuel Berg
Subject: Re: function to get inverse color name?
Date: Fri, 25 Apr 2014 00:58:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

unfrostedpoptart <david@therogoffs.com> writes:

> Does anyone have a function that takes a named color
> (e.g. "Red") and returns the inverse?  I guess it
> would convert the name to RRGGBB, subtract each 8-bit
> value from 256, and then convert back to a name.

;; Try this:

;; "#FFFFFF" is white, so this will produce - "black"

(let ((color (color-values (color-complement-hex "#FFFFFF"))))
  (dolist (c (tty-color-alist))
    (if (eq color (cddr c)) (return (car c))) ))

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

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