diff options
-rwxr-xr-x | lib/RHRD/utils.pm | 17 | ||||
-rwxr-xr-x | test/pool-colors | 47 |
2 files changed, 23 insertions, 41 deletions
diff --git a/lib/RHRD/utils.pm b/lib/RHRD/utils.pm index b08705d..d06e1ce 100755 --- a/lib/RHRD/utils.pm +++ b/lib/RHRD/utils.pm @@ -70,6 +70,23 @@ use constant { CMDLINE_WEEK_HINT => "must be one of W1, W2, W3, W4", CMDLINE_DOW_HINT => "must be one of MO, TU, WE, TH, FR, SA, SU", + + # this is a subset of the colors from: stackoverflow.com/questions/2328339 + POOL_COLORS => ["FFFF00", "1CE6FF", "FF34FF", "FF4A46", "008941", "006FA6", "A30059", + "FFDBE5", "7A4900", "0000A6", "63FFAC", "B79762", "004D43", "8FB0FF", + "5A0007", "809693", "FEFFE6", "4FC601", "3B5DFF", "4A3B53", "FF2F80", + "61615A", "BA0900", "6B7900", "00C2A0", "FFAA92", "FF90C9", "B903AA", + "7B4F4B", "A1C299", "0AA6D8", "00846F", "997D87", "D16100", "6A3A4C", + "FFB500", "C2FFED", "A079BF", "CC0744", "C0B9B2", "C2FF99", "012C58", + "00489C", "6F0062", "0CBD66", "EEC3FF", "B77B68", "7A87A1", "788D66", + "885578", "FAD09F", "FF8A9A", "D157A0", "BEC459", "0086ED", "886F4C", + "549E79", "FFF69F", "72418F", "BC23FF", "99ADC0", "3A2465", "922329", + "5B4534", "FDE8DC", "404E55", "0089A3", "CB7E98", "A4E804", "324E72", + "B4A8BD", "452C2C", "636375", "A3C8C9", "9B9700", "D0AC94", "FF6832", + "575329", "00FECF", "B05B6F", "8CD0FF", "1E6E00", "66E1D3", "CFCDAC", + "A77500", "6367A9", "A05837", "772600", "D790FF", "5B4E51", "8ADBB4", + "83AB58", "D1F7CE", "C8D0F6", "A3A489", "806C66", "BF5650", "66796D", + "DA007C", "FF1A59"] }; sub dropbox_param_type_ok diff --git a/test/pool-colors b/test/pool-colors index 1d4f352..faeb6a8 100755 --- a/test/pool-colors +++ b/test/pool-colors @@ -21,58 +21,23 @@ # use strict; -use Data::Dumper::Simple; -use Color::Scheme; -# print "<!DOCTYPE HTML>\n"; -# print "<html>\n"; -# print " <head>\n"; -# print " <title>color palatete</title>\n"; -# print " </head>\n"; -# print " <body>\n"; -# for(my $base = 0; $base <= 360; $base+=18) { -# my $scheme = Color::Scheme->new->from_hue($base)->scheme('triade')->distance(0.1)->variation('pastel')->web_safe(1); -# my @colors = $scheme->colors(); -# print " <div style=\"float: left\">\n"; -# foreach (@colors) { -# print ' <div style="width: 8em; padding: 1em; font-weight: bold; text-align: center; background-color: #' . $_ . ';">#' . $_ . '</div>' . "\n"; -# } -# print " </div>\n"; -# } -# print " </body>\n"; -# print "</html>\n"; +use lib "../lib/"; +use RHRD::utils; -my %color_map; - -for(my $base = 0; $base <= 360; $base+=1) { - my $scheme = Color::Scheme->new->from_hue($base)->scheme('contrast')->variation('pastel')->web_safe(1); - my @c = $scheme->colors(); - foreach (@c) { - $color_map{$_} = 1; - } -} - -for(my $base = 0; $base <= 360; $base+=1) { - my $scheme = Color::Scheme->new->from_hue($base)->scheme('contrast')->variation('hard')->web_safe(1); - my @c = $scheme->colors(); - foreach (@c) { - $color_map{$_} = 1; - } -} -delete $color_map{'ffffff'}; +my @colors = @{+RHRD::utils::POOL_COLORS}; print "<!DOCTYPE HTML>\n"; print "<html>\n"; print " <head>\n"; print " <title>color palatete</title>\n"; print " </head>\n"; -print " <body>\n"; - -my @colors = keys %color_map; -for(my $i = 0; $i < $#colors; $i+=1) { +print " <body style=\"font-size: 0.7em;\">\n"; +for(my $i = 0; $i <= $#colors; $i+=1) { if(($i % 10) == 0) { print " </div>\n" unless($i == 0); print " <div style=\"float: left;\">\n"; + print " <div style=\"width: 8em; padding: 1em; font-weight: bold; text-align: center;\">$i</div>\n"; } print ' <div style="width: 8em; padding: 1em; font-weight: bold; text-align: center; background-color: #' . $colors[$i] . ';">#' . $colors[$i] . '</div>' . "\n"; } |