all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Lars Magne Ingebrigtsen'" <larsi@gnus.org>, <emacs-devel@gnu.org>
Subject: RE: /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check):Convert colors to hexadecimal with shr-color->hexadecimal.
Date: Tue, 23 Nov 2010 16:12:32 -0800	[thread overview]
Message-ID: <4A76DA00C61D4637AC671E53FB7A4FCB@us.oracle.com> (raw)
In-Reply-To: <m3mxoz7jpk.fsf@quimbies.gnus.org>

> > I see.  Why not just use hexrgb.el (or build on it)?  It's 
> > been around long enough that such teething problems should
> > have been eliminated.
>
> ... 
> color-lab computes a "distance" between black and a blue
> hue that is readable... 
> 
> So it doesn't have much to do with hexrgb.el, I think.

Dunno.

Such a particular color distance computation is I guess complementary to what is
in hexrgb.el.  But in general that is the kind of thing that hexrgb.el does.
For example, `hexrgb-complement' returns the complement of a given color.
Taking the difference between the hue values of two colors gives you a hue
distance, and so on.

That kind of color distance is already there - nothing to be done.  You can
easily combine these kinds of distance in some way - e.g. A * hue-dist + B *
saturation-dist + C * value-dist = my-dist.

You seem to be describing something oriented toward a particular application:
"just distant enough to improve readability" or some such.  It would not be
off-topic for hexrgb to include such a color-distance metric.  I just haven't
needed that so I haven't added it.

If it is decided to include hexrgb.el in Emacs then we could add such a function
to hexrgb.el if the function is fairly general.  Or we could add it elsewhere
(e.g. gnus) and just use hexrgb.el for its definition (or not).

It sounds like the real task for your function is the design: just what kind of
distance function do you want?  You mention "readable", so that could be one
criterion of use.  But the devil might well be in the details (influence of
dark/light backgrounds, human eye characteristics, etc.)

Certainly you can already use hexrgb.el to calculate the distance between two
colors in terms of any color components.  The question is what you want to do
with such a difference: what distance is a good one for something to be
"readable enough", etc.

hexrgb.el has an approximately-equal function that you can use for this kind of
thing (not approximatly equal = sufficiently distant), passing an appropriate
fuzz factor.

For instance, I do something similar in my palette.el code, in order to
determine when a color is essentially the same as its complement.  When that's
the case I change the cursor color to an alternative color that stands out
better against that color as background.

You might look at hexrgb.el to see if you can use the functions there to define
what you need.  Just a suggestion.

In sum, this sounds hexrgb.el-like to me, and I cannot tell whether what you
want is already available using what is in hexrgb.el.




  reply	other threads:[~2010-11-24  0:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1PKgZg-0005td-8L@internal.in.savannah.gnu.org>
2010-11-23 19:50 ` /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check): Convert colors to hexadecimal with shr-color->hexadecimal Glenn Morris
2010-11-23 20:24   ` Chong Yidong
2010-11-23 21:14     ` Julien Danjou
2010-11-23 21:31       ` Chong Yidong
2010-11-23 21:38         ` Lars Magne Ingebrigtsen
2010-11-23 22:18           ` Chong Yidong
2010-11-23 22:34             ` Lars Magne Ingebrigtsen
2010-11-24  0:12               ` Drew Adams [this message]
2010-11-24  9:08                 ` /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check):Convert " Julien Danjou
2010-11-24 11:35                   ` Eli Zaretskii
2010-11-24 14:46                     ` Stefan Monnier
2010-11-24 15:30                       ` Lennart Borgman
2010-11-24 18:15                         ` Ted Zlatanov
2010-11-24 21:37                           ` Lennart Borgman
2010-11-24 22:19                       ` Lars Magne Ingebrigtsen
2010-11-24 22:41                         ` Use color-tweaking code to improve face defaults? [was: /srv/bzr/emacs/trunk r1...] Drew Adams
2010-11-25  4:53                         ` /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check):Convert colors to hexadecimal with shr-color->hexadecimal Stefan Monnier
2010-12-10 19:19                           ` Ted Zlatanov
2010-11-24 16:15                   ` Drew Adams
2010-11-24 18:11                     ` Ted Zlatanov
2010-11-24 21:00                       ` /srv/bzr/emacs/trunk r102478: shr.el(shr-tag-color-check):Convert colors to hexadecimal withshr-color->hexadecimal Drew Adams
2010-11-24 21:33                         ` Julien Danjou
2010-11-24 21:51                           ` Drew Adams
2010-11-24 16:29                   ` /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check):Convert colors to hexadecimal with shr-color->hexadecimal Chong Yidong
2010-11-24  0:05             ` Drew Adams
2010-11-24  8:36         ` /srv/bzr/emacs/trunk r102478: shr.el (shr-tag-color-check): Convert " Richard Stallman
2010-11-24 14:42           ` Stefan Monnier
2010-11-23 21:16     ` Lars Magne Ingebrigtsen
2010-11-23 22:19       ` Ted Zlatanov
2010-11-23 21:14   ` Julien Danjou

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A76DA00C61D4637AC671E53FB7A4FCB@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.