X11 colors, on white background

Here are the semi-standard X11 color names that usually work in HTML. The RGB values are listed below each name.

The Colors.pm module contains a hash called %Colors::color_rgb that can be used to allocate all of these colors into a GD Image object. The code needed in your file to do this is:

    use Colors;
    my $im = new GD::Image(1000, 800);  # image object
    my $background = $im->colorAllocate(255,255,255);
    my $black = $im->colorAllocate(0, 0, 0);
    my %colors;
    foreach my $color_name (keys %Colors::color_rgb) {
        $colors{$color_name} = $im->colorAllocate(@{$Colors::color_rgb{$color_name}}  );
    }

This code generates a 1000 x 800 pixel image object and allocates the colors into the %colors hash. The keys to the hash are the color names in the chart above. It is necessary to first allocate a background color: white (RGB= 255, 255, 255) in this case.

The Colors.pm module is in /home/share/perl_lib on biolinx. It should be accessible from any directory on that machine.


Here is the code for Colors.pm.