unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: function to get inverse color name?
Date: Fri, 25 Apr 2014 00:58:58 +0200	[thread overview]
Message-ID: <87oazq49n1.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: 2c7e7b5b-73ec-45ae-9bf5-b638aad861ff@googlegroups.com

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


      parent reply	other threads:[~2014-04-24 22:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24  3:03 function to get inverse color name? unfrostedpoptart
2014-04-24 13:44 ` Drew Adams
2014-04-24 18:08   ` David Rogoff
2014-04-24 17:51 ` Emanuel Berg
2014-04-24 22:58 ` Emanuel Berg [this message]

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=87oazq49n1.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.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).