On 10/14/2009 12:26 PM, Romain Francois wrote:

On 10/14/2009 12:05 AM, Barry Rowlingson wrote:

On Tue, Oct 13, 2009 at 10:58 PM, Bryan Hanson<han...@depauw.edu> wrote:
Works perfectly! Thanks Barry. I had actually seen some suggestions on
using a distance, but by then I was thinking about hcl spaces and
distance
isn't so as simple there. I'm too tired I think.

Anyway, you've got me running again! Thanks, Bryan

There's a CPAN module for Perl that does hcl colour similarity:

>http://search.cpan.org/~mbarbon/Color-Similarity-HCL-0.04/lib/Color/Similarity/HCL.pm


the Perl code is pretty neat, looks easy to R-ify - released under
the perl license.

Barry

There are a few unexported functions in the xterm256 package to deal
with this.

 > colors()[ xterm256:::closest.character( "#aabbcc" ) ]
[1] "gold4"

Actually that is wrong closest.character gives you the index of the closest xterm256 color, as in : http://frexx.de/xterm-256-notes/

sorry for the misleading answer ...

The package pretends it writes the text using the background of
foreground color as usually represented in R, but it actually first
grabs the closest color (in the RGB space according to the euclidian
metric, I have no idea whether a different space or a different metric
would be better)

This presentation might give a clue :
http://www.agrocampus-ouest.fr/math/useR-2009//slides/Zeileis+Hornik+Murrell.pdf


Romain



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to