Here is some example on how to generate the "R/G/B-ish" lists:
#!/usr/bin/perl -Twl
use strict;
my @SAFE = qw(0 51 102 153 204 255);
my @RGB = ([RED => 0], [GREEN => 1], [BLUE => 2]);
sub get_set {grep { $_ >= $_[0] && $_ < $_[1] } @SAFE}
sub dec_hex {map {sprintf "%02x", $_} @_}
sub permute {
my $last = pop @_;
return map [$_], @$last if(!@_);
return map {
my $left = $_;
map [@$left, $_], @$last
} permute(@_);
}
foreach my $R (@RGB) {
print $/, $R->[0], 'ish:';
foreach my $t (get_set(51, 256)) {
my @clrs = get_set(0, $t);
foreach (permute(\@clrs, \@clrs)) {
my @tuple = @$_;
splice(@tuple, $R->[1], 0, $t);
print '#', dec_hex(@tuple);
}
}
}
print $/, 'GRAYish:';
print '#', dec_hex(($_)x3) for @SAFE;
| [reply] [d/l] |
Ahem. This would mean to really plug in some real graphics knowledge (some maths model for the “color spectrum” and things like that), area that I don't happen to know too much about. ;-)
Some fellow monks asked about related things getting back information that could also help you: RGB values and color name, color selection image map, ... (search for color, RGB, etc)
OTOH, if all that you want is "red", "green" and "blue", than I suppose you could use a combinations-like algorithm, e.g. "redish" is every tuple that has the first term numerically bigger by both others two: #996633: 99>66 && 99 > 33 => it is "redish"
| [reply] [d/l] |