1Graph::colour(3) User Contributed Perl Documentation Graph::colour(3)
2
3
4
6 GD::Graph::colour - Colour manipulation routines for use with GD::Graph
7
9 use GD::Graph::colour qw(:colours :lists :files :convert);
10
12 The GD::Graph::colour package provides a few routines to work with
13 colours. The functionality of this package is mainly defined by what is
14 needed, now and historically, by the GD::Graph modules.
15
17 colour_list( number of colours )
18
19 Returns a list of number of colours colour names known to the package.
20 Exported with the :lists tag.
21
22 sorted_colour_list( number of colours )
23
24 Returns a list of number of colours colour names known to the package,
25 sorted by luminance or hue. NB. Right now it always sorts by lumi‐
26 nance. Will add an option in a later stage to decide sorting method at
27 run time. Exported with the :lists tag.
28
29 _rgb( colour name )
30
31 Returns a list of the RGB values of colour name. if the colour name is
32 a string of the form that is acceptable to the hex2rgb sub, then the
33 colour will be added to the list dynamically. Exported with the
34 :colours tag.
35
36 _hue( R,G,B )
37
38 Returns the hue of the colour with the specified RGB values. Exported
39 with the :colours tag.
40
41 _luminance( R,G,B )
42
43 Returns the luminance of the colour with the specified RGB values.
44 Exported with the :colours tag.
45
46 add_colour(colourname => [$r, $g, $b]) or add_colour('#7fe310')
47
48 Self-explanatory. Exported with the :colours tag.
49
50 rgb2hex($red, $green, $blue)
51
52 hex2rgb('#7fe310')
53
54 These functions translate a list of RGB values into a hexadecimal
55 string, as is commonly used in HTML and the Image::Magick API, and vice
56 versa. Exported with the :convert tag.
57
58 read_rgb( file name )
59
60 Reads in colours from a rgb file as used by the X11 system.
61
62 Doing something like:
63
64 use GD::Graph::bars;
65 use GD::Graph::colour;
66
67 GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";
68
69 Will allow you to use any colours defined in rgb.txt in your graph.
70 Exported with the :files tag.
71
73 white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow,
74 yellow, dyellow, lgreen, green, dgreen, lred, red, dred, lpurple, pur‐
75 ple, dpurple, lorange, orange, pink, dpink, marine, cyan, lbrown,
76 dbrown.
77
79 Martien Verbruggen <mgjv@tradingpost.com.au>
80
81 Copyright
82
83 GIFgraph: Copyright (c) 1995-1999 Martien Verbruggen. Chart::PNGgraph:
84 Copyright (c) 1999 Steve Bonds. GD::Graph: Copyright (c) 1999 Martien
85 Verbruggen.
86
87 All rights reserved. This package is free software; you can redis‐
88 tribute it and/or modify it under the same terms as Perl itself.
89
91 GD::Graph, GD::Graph::FAQ
92
93
94
95perl v5.8.8 2005-12-13 Graph::colour(3)