1Graphics::Toolkit::ColoUrs:e:rCoCnosnttarnitb(u3t)ed PerGlraDpohciucmse:n:tTaotoiloknit::Color::Constant(3)
2
3
4
6 Graphics::Toolkit::Color::Constant - access values of color constants
7
9 use Graphics::Toolkit::Color::Constant qw/:all/;
10 my @names = Graphics::Color::Constant::all_names();
11 my @rgb = rgb_from_name('darkblue');
12 my @hsl = hsl_from_name('darkblue');
13
14 Graphics::Toolkit::Color::Value::add_rgb('lucky', [0, 100, 50]);
15
17 RGB and HSL values of named colors from the X11, HTML(CSS), SVG
18 standard and Pantone report. Allows also nearby search, reverse search
19 and storage (not permanent) of additional names. One color may have
20 multiple names. Own colors can be (none permanently) stored for later
21 reference by name. For this a name has to be chosen, that is not
22 already taken. The corresponding color may be defined by an RGB or HSL
23 triplet.
24
25 No symbol is imported by default. The sub symbols: "rgb_from_name",
26 "hsl_from_name", "name_from_rgb", "name_from_hsl" may be imported
27 individually or by:
28
29 use Graphics::Toolkit::Color::Constant qw/:all/;
30
32 rgb_from_name
33 Red, Green and Blue value of the named color. These values are integer
34 in 0 .. 255.
35
36 my @rgb = Graphics::Toolkit::Color::Constant::rgb_from_name('darkblue');
37 @rgb = Graphics::Toolkit::Color::Constant::rgb_from_name('dark_blue'); # same result
38 @rgb = Graphics::Toolkit::Color::Constant::rgb_from_name('DarkBlue'); # still same
39
40 hsl_from_name
41 Hue, saturation and lightness of the named color. These are integer
42 between 0 .. 359 (hue) or 100 (sat. & light.). A hue of 360 and 0
43 (degree in a cylindrical coordinate system) is considered to be the
44 same, this modul deals only with the ladder.
45
46 my @hsl = Graphics::Toolkit::Color::Constant::hsl_from_name('darkblue');
47
48 name_from_rgb
49 Returns name of color with given rgb value triplet. Returns empty
50 string if color is not stored. When several names define given color,
51 the shortest name will be selected in scalar context. In array context
52 all names are given.
53
54 say Graphics::Toolkit::Color::Constant::name_from_rgb( 15, 10, 121 ); # 'darkblue'
55 say Graphics::Toolkit::Color::Constant::name_from_rgb([15, 10, 121]); # works too
56
57 name_from_hsl
58 Returns name of color with given hsl value triplet. Returns empty
59 string if color is not stored. When several names define given color,
60 the shortest name will be selected in scalar context. In array context
61 all names are given.
62
63 say scalar Graphics::Toolkit::Color::Constant::name_from_hsl( 0, 100, 50 ); # 'red'
64 scalar Graphics::Toolkit::Color::Constant::name_from_hsl([0, 100, 50]); # works too
65 say for Graphics::Toolkit::Color::Constant::name_from_hsl( 0, 100, 50 ); # 'red', 'red1'
66
67 names_in_hsl_range
68 Color names in selected neighbourhood of hsl color space, that look
69 similar. It requires two arguments. The first one is an array
70 containing three values (hue, saturation and lightness), that define
71 the center of the neighbourhood (searched area).
72
73 The second argument can either be a number or again an array with three
74 values (h,s and l). If its just a number, it will be the radius r of a
75 ball, that defines the neighbourhood. From all colors inside that ball,
76 that are equal distanced or nearer to the center than r, one name will
77 returned.
78
79 If the second argument is an array, it has to contain the tolerance
80 (allowed distance) in h, s and l direction. Please note the h dimension
81 is circular: the distance from 355 to 0 is 5. The s and l dimensions
82 are linear, so that a center value of 90 and a tolerance of 15 will
83 result in a search of in the range 75 .. 100.
84
85 The results contains only one name per color (the shortest).
86
87 # all bright red'ish clors
88 my @names = Graphics::Toolkit::Color::Constant::names_in_hsl_range([0, 90, 50], 5);
89 # approximates to :
90 my @names = Graphics::Toolkit::Color::Constant::names_in_hsl_range([0, 90, 50],[ 3, 3, 3]);
91
92 all_names
93 A sorted list of all stored color names.
94
95 name_taken
96 A perlish pseudo boolean tells if the color name is already in use.
97
98 add_rgb
99 Adding a color to the store under an not taken (not already used) name.
100 Arguments are name, red, green and blue value (integer < 256, see rgb).
101
102 Graphics::Toolkit::Color::Constant::add_rgb('nightblue', 15, 10, 121 );
103 Graphics::Toolkit::Color::Constant::add_rgb('nightblue', [15, 10, 121]);
104
105 add_hsl
106 Adding a color to the store under an not taken (not already used) name.
107 Arguments are name, hue, saturation and lightness value (see hsl).
108
109 Graphics::Toolkit::Color::Constant::add_rgb('lucky', 0, 100, 50 );
110 Graphics::Toolkit::Color::Constant::add_rgb('lucky', [0, 100, 50]);
111
112 NAMES
113 white, black, red, green, blue, yellow, purple, pink, peach, plum,
114 mauve, brown, grey
115
116 aliceblue, antiquewhite, antiquewhite1, antiquewhite2, antiquewhite3,
117 antiquewhite4, aqua, aquamarine, aquamarine1, aquamarine2, aquamarine3,
118 aquamarine4, azure, azure1, azure2, azure3, azure4, beige, bisque,
119 bisque1, bisque2, bisque3, bisque4, blanchedalmond, blue1, blue2,
120 blue3, blue4, blueviolet, brown1, brown2, brown3, brown4, burlywood,
121 burlywood1, burlywood2, burlywood3, burlywood4, cadetblue, cadetblue1,
122 cadetblue2, cadetblue3, cadetblue4, chartreuse, chartreuse1,
123 chartreuse2, chartreuse3, chartreuse4, chocolate, chocolate1,
124 chocolate2, chocolate3, chocolate4, coral, coral1, coral2, coral3,
125 coral4, cornflowerblue, cornsilk, cornsilk1, cornsilk2, cornsilk3,
126 cornsilk4, crimson, cyan, cyan1, cyan2, cyan3, cyan4, darkblue,
127 darkcyan, darkgoldenrod, darkgoldenrod1, darkgoldenrod2,
128 darkgoldenrod3, darkgoldenrod4, darkgray, darkgreen, darkkhaki,
129 darkmagenta, darkolivegreen, darkolivegreen1, darkolivegreen2,
130 darkolivegreen3, darkolivegreen4, darkorange, darkorange1, darkorange2,
131 darkorange3, darkorange4, darkorchid, darkorchid1, darkorchid2,
132 darkorchid3, darkorchid4, darkred, darksalmon, darkseagreen,
133 darkseagreen1, darkseagreen2, darkseagreen3, darkseagreen4,
134 darkslateblue, darkslategray, darkslategray1, darkslategray2,
135 darkslategray3, darkslategray4, darkturquoise, darkviolet, deeppink,
136 deeppink1, deeppink2, deeppink3, deeppink4, deepskyblue, deepskyblue1,
137 deepskyblue2, deepskyblue3, deepskyblue4, dimgray, dodgerblue,
138 dodgerblue1, dodgerblue2, dodgerblue3, dodgerblue4, firebrick,
139 firebrick1, firebrick2, firebrick3, firebrick4, floralwhite,
140 forestgreen, fuchsia, gainsboro, ghostwhite, gold, gold1, gold2, gold3,
141 gold4, goldenrod, goldenrod1, goldenrod2, goldenrod3, goldenrod4, gray,
142 gray1, gray2, gray3, gray4, gray5, gray6, gray7, gray8, gray9, gray10,
143 gray11, gray12, gray13, gray14, gray15, gray16, gray17, gray18, gray19,
144 gray20, gray21, gray22, gray23, gray24, gray25, gray26, gray27, gray28,
145 gray29, gray30, gray31, gray32, gray33, gray34, gray35, gray36, gray37,
146 gray38, gray39, gray40, gray41, gray42, gray43, gray44, gray45, gray46,
147 gray47, gray48, gray49, gray50, gray51, gray52, gray53, gray54, gray55,
148 gray56, gray57, gray58, gray59, gray60, gray61, gray62, gray63, gray64,
149 gray65, gray66, gray67, gay68, gray69, gray70, gray71, gray72, gray73,
150 gray74, gray75, gray76, gray77, gray78, gray79, gray80, gray81, gray82,
151 gray83, gray84, gray85, gray86, gray87, gray88, gray89, gray90, gray91,
152 gray92, gray93, gray94, gray95, gray97, gray98, gray99, green1, green2,
153 green3, green4, greenyellow, grey1, grey2, grey3, grey4, honeydew,
154 honeydew1, honeydew2, honeydew3, honeydew4, hotpink, hotpink1,
155 hotpink2, hotpink3, hotpink4, indianred, indianred1, indianred2,
156 indianred3, indianred4, indigo, ivory, ivory1, ivory2, ivory3, ivory4,
157 khaki, khaki1, khaki2, khaki3, khaki4, lavender, lavenderblush,
158 lavenderblush1, lavenderblush2, lavenderblush3, lavenderblush4,
159 lawngreen, lemonchiffon, lemonchiffon1, lemonchiffon2, lemonchiffon3,
160 lemonchiffon4, light, lightblue, lightblue1, lightblue2,
161 lightblue3,lightblue4, lightcoral, lightcyan, lightcyan1, lightcyan2,
162 lightcyan3, lightcyan4, lightgoldenrod, lightgoldenrod1,
163 lightgoldenrod2, lightgoldenrod3, lightgoldenrod4, lightgray,
164 lightgreen, lightpink, lightpink1, lightpink2, lightpink3, lightpink4,
165 lightpurple, lightsalmon, lightsalmon1, lightsalmon2, lightsalmon3,
166 lightsalmon4, lightseagreen, lightskyblue, lightskyblue1,
167 lightskyblue2, lightskyblue3, lightskyblue4, lightslateblue,
168 lightslategray, lightsteelblue, lightsteelblue1, lightsteelblue2,
169 lightsteelblue3, lightsteelblue4, lightyellow, lightyellow1,
170 lightyellow2, lightyellow3, lightyellow4, lime, limegreen, linen,
171 magenta, magenta1, magenta2, magenta3, magenta4, maroon, maroon1,
172 maroon2, maroon3, maroon4, medium, mediumaquamarine, mediumblue,
173 mediumorchid, mediumorchid1, mediumorchid2, mediumorchid3,
174 mediumorchid4, mediumpurple, mediumpurple1, mediumpurple2,
175 mediumpurple3, mediumpurple4, mediumseagreen, mediumslateblue,
176 mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue,
177 mintcream, mistyrose, mistyrose1, mistyrose2, mistyrose3, mistyrose4,
178 moccasin, navajowhite, navajowhite1, navajowhite2, navajowhite3,
179 navajowhite4, navy, navyblue, oldlace, olive, olivedrab, olivedrab1,
180 olivedrab2, olivedrab3, olivedrab4, orange, orange1, orange2, orange3,
181 orange4, orangered, orangered1, orangered2, orangered3, orangered4,
182 orchid, orchid1, orchid2, orchid3, orchid4, pale, palegoldenrod,
183 palegreen, palegreen1, palegreen2, palegreen3, palegreen4,
184 paleturquoise, paleturquoise1, paleturquoise2, paleturquoise3,
185 paleturquoise4, palevioletred, palevioletred1, palevioletred2,
186 palevioletred3, palevioletred4, papayawhip, peachpuff, peachpuff1,
187 peachpuff2, peachpuff3, peachpuff4, peru, pink1, pink2, pink3, pink4,
188 plum1, plum2, plum3, plum4, powderblue, purple1, purple2, purple3,
189 purple4, rebeccapurple, red1, red2, red3, red4, rosybrown, rosybrown1,
190 rosybrown2, rosybrown3, rosybrown4, royalblue, royalblue1, royalblue2,
191 royalblue3, royalblue4, saddlebrown, salmon, salmon1, salmon2, salmon3,
192 salmon4, sandybrown, seagreen, seagreen1, seagreen2, seagreen3,
193 seagreen4, seashell, seashell1, seashell2, seashell3, seashell4,
194 sienna, sienna1, sienna2, sienna3, sienna4, silver, skyblue, skyblue1,
195 skyblue2, skyblue3, skyblue4, slateblue, slateblue1, slateblue2,
196 slateblue3, slateblue4, slategray, slategray1, slategray2, slategray3,
197 slategray4, snow, snow1, snow2, snow3, snow4, springgreen,
198 springgreen1, springgreen2, springgreen3, springgreen4, steelblue,
199 steelblue1, steelblue2, steelblue3, steelblue4, tan, tan1, tan2, tan3,
200 tan4, teal, thistle, thistle1, thistle2, thistle3, thistle4, tomato,
201 tomato1, tomato2, tomato3, tomato4, turquoise, turquoise1, turquoise2,
202 turquoise3, turquoise4, violet, violetred, violetred1, violetred2,
203 violetred3, violetred4, wheat, wheat1, wheat2, wheat3, wheat4,
204 whitesmoke, yellow1, yellow2, yellow3, yellow4, yellowgreen
205
206 marsala, radiandorchid, emerald, tangerinetango, honeysucle, turquoise,
207 mimosa, blueizis, chilipepper, sanddollar, blueturquoise, tigerlily,
208 aquasky, truered, fuchsiarose, ceruleanblue, rosequartz, peachecho,
209 serenity, snorkelblue, limpetshell, lilacgrey, icedcoffee, fiesta,
210 buttercup, greenflash, riverside, airyblue, sharkskin, aurorared,
211 warmtaupe, dustycedar, lushmeadow, spicymustard, pottersclay,
212 bodacious, greenery, niagara, primroseyellow, lapisblue, flame,
213 islandparadise, paledogwood, pinkyarrow, kale, hazelnut, grenadine,
214 balletslipper, butterum, navypeony, neutralgray, shadedspruce,
215 goldenlime, marina, autumnmaple, meadowlark, cherrytomato,
216 littleboyblue, chilioil, pinklavender, bloomingdahlia, arcadia,
217 ultraviolet, emperador, almostmauve, springcrocus, sailorblue,
218 harbormist, warmsand, coconutmilk, redpear, valiantpoppy, nebulasblue,
219 ceylonyellow, martiniolive, russetorange, crocuspetal, limelight,
220 quetzalgreen, sargassosea, tofu, almondbuff, quietgray, meerkat,
221 fiesta, jesterred, turmeric, livingcoral, pinkpeacock, pepperstem,
222 aspengold, princessblue, toffee, mangomojito, terrariummoss,
223 sweetlilac, soybean, eclipse, sweetcorn, browngranite, chilipepper,
224 bikingred, peachpink, rockyroad, fruitdove, sugaralmond, darkcheddar,
225 galaxyblue, bluestone, orangetiger, eden, vanillacustard, eveningblue,
226 paloma, guacamole, flamescarlet, saffron, biscaygreen, chive,
227 fadeddenim, orangepeel, mosaicblue, sunlight, coralpink,
228 grapecompote, lark, navyblazer, brilliantwhite, ash, amberglow, samba,
229 sandstone, classicblue, greensheen, rosetan, ultramarinegreen,
230 firedbrick, peachnougat, magentapurple, marigold, cerulean, rust,
231 illuminating, frenchblue, greenash, burntcoral, mint, amethystorchid,
232 raspberrysorbet, inkwell, ultimategray, buttercream, desertmist, willow
233
235 Graphics::ColorNamesLite::All
236
238 Copyright 2022 Herbert Breunung.
239
240 This program is free software; you can redistribute it and/or modify it
241 under same terms as Perl itself.
242
244 Herbert Breunung, <lichtkind@cpan.org>
245
246
247
248perl v5.36.1 2023-07-G2r4aphics::Toolkit::Color::Constant(3)