[Top][All Lists]

[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 <address@hidden> 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:

reply via email to

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