GD::Graph::colour - Colour manipulation routines for use with GD::Graph
Contents
Description
The GD::Graph::colour package provides a few routines to work with colours. The functionality of this
package is mainly defined by what is needed, now and historically, by the GD::Graph modules.
Functions
colour_list(numberofcolours)
Returns a list of numberofcolours colour names known to the package. Exported with the :lists tag.
sorted_colour_list(numberofcolours)
Returns a list of numberofcolours colour names known to the package, sorted by luminance or hue. NB.
Right now it always sorts by luminance. Will add an option in a later stage to decide sorting method at
run time. Exported with the :lists tag.
_rgb(colourname)
Returns a list of the RGB values of colourname. if the colour name is a string of the form that is
acceptable to the hex2rgb sub, then the colour will be added to the list dynamically. Exported with the
:colours tag.
_hue(R,G,B)
Returns the hue of the colour with the specified RGB values. Exported with the :colours tag.
_luminance(R,G,B)
Returns the luminance of the colour with the specified RGB values. Exported with the :colours tag.
add_colour(colourname=>[$r,$g,$b])oradd_colour('#7fe310')
Self-explanatory. Exported with the :colours tag.
rgb2hex($red,$green,$blue)hex2rgb('#7fe310')
These functions translate a list of RGB values into a hexadecimal string, as is commonly used in HTML and
the Image::Magick API, and vice versa. Exported with the :convert tag.
read_rgb(filename)
Reads in colours from a rgb file as used by the X11 system.
Doing something like:
use GD::Graph::bars;
use GD::Graph::colour;
GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";
Will allow you to use any colours defined in rgb.txt in your graph. Exported with the :files tag.
Name
GD::Graph::colour - Colour manipulation routines for use with GD::Graph
Predefined Colour Names
white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow, yellow, dyellow, lgreen, green,
dgreen, lred, red, dred, lpurple, purple, dpurple, lorange, orange, pink, dpink, marine, cyan, lbrown,
dbrown.
See Also
GD::Graph, GD::Graph::FAQ
perl v5.36.0 2023-04-25 Graph::colour(3pm)
Synopsis
use GD::Graph::colour qw(:colours :lists :files :convert);
