[Bio] / FigKernelPackages / WebColors.pm Repository:
ViewVC logotype

View of /FigKernelPackages/WebColors.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (download) (as text) (annotate)
Fri Sep 5 12:05:27 2008 UTC (11 years, 5 months ago) by paczian
Branch: MAIN
CVS Tags: rast_rel_2009_05_18, rast_rel_2008_12_18, rast_2008_0924, rast_rel_2008_09_30, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, mgrast_rel_2008_0625, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0923, mgrast_rel_2008_0919, mgrast_rel_2008_1110, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, rast_rel_2009_03_26, rast_rel_2008_11_24
Changes since 1.6: +47 -0 lines
added palette 'excel' with the default excel color palette minus black, white and duplicates

package WebColors;

1;

use strict;
use warnings;

=pod

=head1 NAME

WebColors - returns different color sets for consistant color usage in the web

=head1 DESCRIPTION

Web colors has a set of color palettes for different purposes. These palettes are
represented by sets RGB values.

=head1 METHODS

=over 4


=item * B<get_colors> ()

The first implemented color method, still in here for backward compatability.
You should be using get_palette instead.

=cut

sub get_colors {

  my $colors =  [ [ 255, 255, 255 ],
		  [ 0, 0, 0 ],
		  [ 235, 5, 40 ],
		  [ 200, 200, 200 ],
		  [ 50, 255, 50 ],
		  [ 60, 60, 190 ],
		  [ 145, 175, 160 ],
		  [ 224, 133, 15 ],
		  [ 0, 0, 155 ],
		  [ 255, 221, 0 ],
		  [ 0, 155, 155 ],
		  [ 200, 100, 200 ],
		  [ 27, 133, 52 ],
		  [ 135, 65, 65 ],
		  [ 0, 90, 255 ],
		  [ 95, 100, 100 ],
		  [ 80, 210, 150 ],
		  [ 225, 250, 160 ],
		  [ 170, 30, 145 ],
		  [ 255, 215, 125 ],
		  [ 140, 165, 210 ],
		  [ 160, 15, 250 ],
		  [ 45, 155, 185 ],
		  [ 170, 205, 120 ],
		  [ 30, 60, 190 ],
		  [ 115, 175, 160 ],
		  [ 194, 133, 15 ],
		  [ 0, 0, 125 ],
		  [ 225, 221, 0 ],
		  [ 255, 0, 0 ],
		  [ 0, 255, 0 ],
		  [ 0, 0, 255 ],
		  [ 255, 255, 0 ],
		  [ 0, 255, 255 ],
		  [ 255, 0, 255 ],
		  [ 255, 127, 0 ],
		  [ 255, 0, 127 ],
		  [ 0, 255, 127 ],
		  [ 127, 0, 255 ],
		  [ 127, 255, 0 ],
		  [ 0, 127, 255 ],
		  [ 255, 127, 127 ],
		  [ 127, 255, 127 ],
		  [ 127, 127, 255 ],
		  [ 0, 0, 127 ],
		  [ 127, 0, 0 ],
		  [ 0, 127, 0 ],
		  [ 127, 127, 0 ],
		  [ 127, 0, 127 ],
		  [ 0, 127, 127 ],
		  [ 255, 127, 255 ],
		  [ 255, 255, 127 ],
		  [ 127, 255, 255 ],
		  [ 223, 1, 17],
		  [ 255, 32, 0],
		  [ 255, 51, 0],
		  [ 255, 102, 0],
		  [ 255, 153, 0],
		  [ 255, 204, 0],
		  [ 255, 255, 0],
		  [ 204, 255, 0],
		  [ 102, 255, 0],
		  [ 0, 255, 0],
		  [ 102, 102, 255],
		  [173, 216, 230],
		  [135, 206, 250],
		  [30, 144, 255],
		  [0, 0, 255],
		  [0, 0, 139] ];
  
  return $colors;
}

=item * B<get_palette> ()

When passed the name of a palette, will return it. A palette is a set of
RGB values. Current options are

'special' - special colors like white, black, background shading, highlighting and such.

'vitamins' - 10 vital colors, well suited for a scale. Ranged from red to blue

'many' - 46 hopefully distiguishable colors for e.g. piecharts, arrowsets

=cut

sub get_palette {
  my ($name) = @_;

  if ($name eq 'special') {
    return [ [ 255, 255, 255 ], # white
	     [ 0, 0, 0 ],       # black
	     [ 200, 200, 200 ], # background shading
	     [ 235, 5, 40 ],    # highlight
	     [ 60, 60, 190 ],   # foreground
	     [ 50, 255, 50 ]];  # special
  }
  
  elsif ($name eq 'vitamins') {
    return [ [ 223, 1, 17],
	     [ 255, 32, 0],
	     [ 255, 51, 0],
	     [ 255, 102, 0],
	     [ 255, 153, 0],
	     [ 255, 204, 0],
	     [ 255, 255, 0],
	     [ 204, 255, 0],
	     [ 102, 255, 0],
	     [ 0, 255, 0] ];
  }

  elsif ($name eq 'many') {
    return [ [ 224, 133, 15 ],
	     [ 0, 0, 155 ],
	     [ 255, 221, 0 ],
	     [ 0, 155, 155 ],
	     [ 200, 100, 200 ],
	     [ 27, 133, 52 ],
	     [ 135, 65, 65 ],
	     [ 0, 90, 255 ],
	     [ 95, 100, 100 ],
	     [ 80, 210, 150 ],
	     [ 225, 250, 160 ],
	     [ 170, 30, 145 ],
	     [ 255, 215, 125 ],
	     [ 140, 165, 210 ],
	     [ 160, 15, 250 ],
	     [ 45, 155, 185 ],
	     [ 170, 205, 120 ],
	     [ 30, 60, 190 ],
	     [ 115, 175, 160 ],
	     [ 194, 133, 15 ],
	     [ 0, 0, 125 ],
	     [ 225, 221, 0 ],
	     [ 255, 0, 0 ],
	     [ 0, 255, 0 ],
	     [ 0, 0, 255 ],
	     [ 255, 255, 0 ],
	     [ 0, 255, 255 ],
	     [ 255, 0, 255 ],
	     [ 255, 127, 0 ],
	     [ 255, 0, 127 ],
	     [ 0, 255, 127 ],
	     [ 127, 0, 255 ],
	     [ 127, 255, 0 ],
	     [ 0, 127, 255 ],
	     [ 255, 127, 127 ],
	     [ 127, 255, 127 ],
	     [ 127, 127, 255 ],
	     [ 0, 0, 127 ],
	     [ 127, 0, 0 ],
	     [ 0, 127, 0 ],
	     [ 127, 127, 0 ],
	     [ 127, 0, 127 ],
	     [ 0, 127, 127 ],
	     [ 255, 127, 255 ],
	     [ 255, 255, 127 ],
	     [ 127, 255, 255 ] ];
  }
  elsif ($name eq 'gradient') {
    return [[204,34,0],
	    [238,85,0],
	    [204,102,0],
	    [204,153,0],
	    [187,204,0],
	    [119,204,0],
	    [34,204,0], 
	    [0,204,187],
	    [0,170,204],
	    [0,119,204],
	    [0,68,204]];
  }
  elsif ($name eq 'excel') {
    return [[255,0,0],
	    [0,128,0],
	    [0,0,128],
	    [128,128,0],
	    [128,0,128],
	    [192,192,192],
	    [128,128,128],
	    [153,153,255],
	    [153,51,102],
	    [255,255,204],
	    [102,0,102],
	    [255,128,128],
	    [0,102,204],
	    [204,204,255],
	    [255,0,255],
	    [255,255,0],
	    [0,255,255],
	    [128,0,128],
	    [128,0,0],
	    [0,128,128],
	    [0,0,255],
	    [0,204,204],
	    [204,255,255],
	    [204,255,204],
	    [255,255,153],
	    [153,204,255],
	    [255,153,204],
	    [204,153,255],
	    [255,204,153],
	    [51,102,255],
	    [51,204,204],
	    [153,204,0],
	    [255,204,0],
	    [255,153,0],
	    [255,102,0],
	    [102,102,153],
	    [150,150,150],
	    [0,51,102],
	    [51,153,102],
	    [0,51,0],
	    [51,51,0],
	    [153,51,0],
	    [153,51,102],
	    [51,51,153],
	    [51,51,51]];
  }
  return undef;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3