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 Returns a list of number of colours colour names known to the package.
19 Exported with the :lists tag.
20
21 sorted_colour_list( number of colours )
22 Returns a list of number of colours colour names known to the package,
23 sorted by luminance or hue. NB. Right now it always sorts by
24 luminance. Will add an option in a later stage to decide sorting method
25 at run time. Exported with the :lists tag.
26
27 _rgb( colour name )
28 Returns a list of the RGB values of colour name. if the colour name is
29 a string of the form that is acceptable to the hex2rgb sub, then the
30 colour will be added to the list dynamically. Exported with the
31 :colours tag.
32
33 _hue( R,G,B )
34 Returns the hue of the colour with the specified RGB values. Exported
35 with the :colours tag.
36
37 _luminance( R,G,B )
38 Returns the luminance of the colour with the specified RGB values.
39 Exported with the :colours tag.
40
41 add_colour(colourname => [$r, $g, $b]) or add_colour('#7fe310')
42 Self-explanatory. Exported with the :colours tag.
43
44 rgb2hex($red, $green, $blue)
45 hex2rgb('#7fe310')
46 These functions translate a list of RGB values into a hexadecimal
47 string, as is commonly used in HTML and the Image::Magick API, and vice
48 versa. Exported with the :convert tag.
49
50 read_rgb( file name )
51 Reads in colours from a rgb file as used by the X11 system.
52
53 Doing something like:
54
55 use GD::Graph::bars;
56 use GD::Graph::colour;
57
58 GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";
59
60 Will allow you to use any colours defined in rgb.txt in your graph.
61 Exported with the :files tag.
62
64 white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow,
65 yellow, dyellow, lgreen, green, dgreen, lred, red, dred, lpurple,
66 purple, dpurple, lorange, orange, pink, dpink, marine, cyan, lbrown,
67 dbrown.
68
70 Martien Verbruggen <mgjv@tradingpost.com.au>
71
72 Copyright
73 GIFgraph: Copyright (c) 1995-1999 Martien Verbruggen. Chart::PNGgraph:
74 Copyright (c) 1999 Steve Bonds. GD::Graph: Copyright (c) 1999 Martien
75 Verbruggen.
76
77 All rights reserved. This package is free software; you can
78 redistribute it and/or modify it under the same terms as Perl itself.
79
81 GD::Graph, GD::Graph::FAQ
82
83
84
85perl v5.36.0 2022-07-22 Graph::colour(3)