| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
################################################################################################### |
|
2
|
|
|
|
|
|
|
# Copyright 2013/2014 by Marcel Greter |
|
3
|
|
|
|
|
|
|
# This file is part of OCBNET-CSS3 (GPL3) |
|
4
|
|
|
|
|
|
|
#################################################################################################### |
|
5
|
|
|
|
|
|
|
package OCBNET::CSS3::Regex::Colors; |
|
6
|
|
|
|
|
|
|
#################################################################################################### |
|
7
|
|
|
|
|
|
|
our $VERSION = '0.2.6'; |
|
8
|
|
|
|
|
|
|
#################################################################################################### |
|
9
|
|
|
|
|
|
|
# Attention: color are not uniquely mapped |
|
10
|
|
|
|
|
|
|
# from rgb to names (gray/gray IE problem). |
|
11
|
|
|
|
|
|
|
# Added a flag that indicates that a color |
|
12
|
|
|
|
|
|
|
# is just an alternative of another one. |
|
13
|
|
|
|
|
|
|
#################################################################################################### |
|
14
|
|
|
|
|
|
|
|
|
15
|
11
|
|
|
11
|
|
54
|
use strict; |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
329
|
|
|
16
|
11
|
|
|
11
|
|
51
|
use warnings; |
|
|
11
|
|
|
|
|
19
|
|
|
|
11
|
|
|
|
|
306
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#################################################################################################### |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# load exporter and inherit from it |
|
21
|
11
|
|
|
11
|
|
54
|
BEGIN { use Exporter qw(); our @ISA = qw(Exporter); } |
|
|
11
|
|
|
11
|
|
24
|
|
|
|
11
|
|
|
|
|
276
|
|
|
|
11
|
|
|
|
|
461
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# define our functions that will be exported |
|
24
|
11
|
|
|
11
|
|
398
|
BEGIN { our @EXPORT = qw($re_color); } |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# define our functions than can be exported |
|
27
|
11
|
|
|
11
|
|
211
|
BEGIN { our @EXPORT_OK = qw(%color_base %color_ext); } |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#################################################################################################### |
|
30
|
|
|
|
|
|
|
|
|
31
|
11
|
|
|
11
|
|
6298
|
use OCBNET::CSS3::Regex::Numbers; |
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
16419
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#################################################################################################### |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# basic color keywords as defined by w3c |
|
36
|
|
|
|
|
|
|
#************************************************************************************************** |
|
37
|
|
|
|
|
|
|
our %color_base = |
|
38
|
|
|
|
|
|
|
( |
|
39
|
|
|
|
|
|
|
'black' => ['#000000', 0, 0, 0], |
|
40
|
|
|
|
|
|
|
'silver' => ['#C0C0C0', 192, 192, 192], |
|
41
|
|
|
|
|
|
|
'gray' => ['#808080', 128, 128, 128], |
|
42
|
|
|
|
|
|
|
'grey' => ['#808080', 128, 128, 128, 1], |
|
43
|
|
|
|
|
|
|
'white' => ['#FFFFFF', 255, 255, 255], |
|
44
|
|
|
|
|
|
|
'maroon' => ['#800000', 128, 0, 0], |
|
45
|
|
|
|
|
|
|
'red' => ['#FF0000', 255, 0, 0], |
|
46
|
|
|
|
|
|
|
'purple' => ['#800080', 128, 0, 128], |
|
47
|
|
|
|
|
|
|
'fuchsia' => ['#FF00FF', 255, 0, 255], |
|
48
|
|
|
|
|
|
|
'green' => ['#008000', 0, 128, 0], |
|
49
|
|
|
|
|
|
|
'lime' => ['#00FF00', 0, 255, 0], |
|
50
|
|
|
|
|
|
|
'olive' => ['#808000', 128, 128, 0], |
|
51
|
|
|
|
|
|
|
'yellow' => ['#FFFF00', 255, 255, 0], |
|
52
|
|
|
|
|
|
|
'navy' => ['#000080', 0, 0, 128], |
|
53
|
|
|
|
|
|
|
'blue' => ['#0000FF', 0, 0, 255], |
|
54
|
|
|
|
|
|
|
'teal' => ['#008080', 0, 128, 128], |
|
55
|
|
|
|
|
|
|
'aqua' => ['#00FFFF', 0, 255, 255], |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# extended color keywords as defined by w3c |
|
59
|
|
|
|
|
|
|
#************************************************************************************************** |
|
60
|
|
|
|
|
|
|
our %color_ext = |
|
61
|
|
|
|
|
|
|
( |
|
62
|
|
|
|
|
|
|
'aliceblue' => ['#f0f8ff', 240, 248, 255], |
|
63
|
|
|
|
|
|
|
'antiquewhite' => ['#faebd7', 250, 235, 215], |
|
64
|
|
|
|
|
|
|
'aqua' => ['#00ffff', 0, 255, 255], |
|
65
|
|
|
|
|
|
|
'aquamarine' => ['#7fffd4', 127, 255, 212], |
|
66
|
|
|
|
|
|
|
'azure' => ['#f0ffff', 240, 255, 255], |
|
67
|
|
|
|
|
|
|
'beige' => ['#f5f5dc', 245, 245, 220], |
|
68
|
|
|
|
|
|
|
'bisque' => ['#ffe4c4', 255, 228, 196], |
|
69
|
|
|
|
|
|
|
'black' => ['#000000', 0, 0, 0], |
|
70
|
|
|
|
|
|
|
'blanchedalmond' => ['#ffebcd', 255, 235, 205], |
|
71
|
|
|
|
|
|
|
'blue' => ['#0000ff', 0, 0, 255], |
|
72
|
|
|
|
|
|
|
'blueviolet' => ['#8a2be2', 138, 43, 226], |
|
73
|
|
|
|
|
|
|
'brown' => ['#a52a2a', 165, 42, 42], |
|
74
|
|
|
|
|
|
|
'burlywood' => ['#deb887', 222, 184, 135], |
|
75
|
|
|
|
|
|
|
'cadetblue' => ['#5f9ea0', 95, 158, 160], |
|
76
|
|
|
|
|
|
|
'chartreuse' => ['#7fff00', 127, 255, 0], |
|
77
|
|
|
|
|
|
|
'chocolate' => ['#d2691e', 210, 105, 30], |
|
78
|
|
|
|
|
|
|
'coral' => ['#ff7f50', 255, 127, 80], |
|
79
|
|
|
|
|
|
|
'cornflowerblue' => ['#6495ed', 100, 149, 237], |
|
80
|
|
|
|
|
|
|
'cornsilk' => ['#fff8dc', 255, 248, 220], |
|
81
|
|
|
|
|
|
|
'crimson' => ['#dc143c', 220, 20, 60], |
|
82
|
|
|
|
|
|
|
'cyan' => ['#00ffff', 0, 255, 255, 1], |
|
83
|
|
|
|
|
|
|
'darkblue' => ['#00008b', 0, 0, 139], |
|
84
|
|
|
|
|
|
|
'darkcyan' => ['#008b8b', 0, 139, 139], |
|
85
|
|
|
|
|
|
|
'darkgoldenrod' => ['#b8860b', 184, 134, 11], |
|
86
|
|
|
|
|
|
|
'darkgray' => ['#a9a9a9', 169, 169, 169], |
|
87
|
|
|
|
|
|
|
'darkgreen' => ['#006400', 0, 100, 0], |
|
88
|
|
|
|
|
|
|
'darkgrey' => ['#a9a9a9', 169, 169, 169, 1], |
|
89
|
|
|
|
|
|
|
'darkkhaki' => ['#bdb76b', 189, 183, 107], |
|
90
|
|
|
|
|
|
|
'darkmagenta' => ['#8b008b', 139, 0, 139], |
|
91
|
|
|
|
|
|
|
'darkolivegreen' => ['#556b2f', 85, 107, 47], |
|
92
|
|
|
|
|
|
|
'darkorange' => ['#ff8c00', 255, 140, 0], |
|
93
|
|
|
|
|
|
|
'darkorchid' => ['#9932cc', 153, 50, 204], |
|
94
|
|
|
|
|
|
|
'darkred' => ['#8b0000', 139, 0, 0], |
|
95
|
|
|
|
|
|
|
'darksalmon' => ['#e9967a', 233, 150, 122], |
|
96
|
|
|
|
|
|
|
'darkseagreen' => ['#8fbc8f', 143, 188, 143], |
|
97
|
|
|
|
|
|
|
'darkslateblue' => ['#483d8b', 72, 61, 139], |
|
98
|
|
|
|
|
|
|
'darkslategray' => ['#2f4f4f', 47, 79, 79], |
|
99
|
|
|
|
|
|
|
'darkslategrey' => ['#2f4f4f', 47, 79, 79, 1], |
|
100
|
|
|
|
|
|
|
'darkturquoise' => ['#00ced1', 0, 206, 209], |
|
101
|
|
|
|
|
|
|
'darkviolet' => ['#9400d3', 148, 0, 211], |
|
102
|
|
|
|
|
|
|
'deeppink' => ['#ff1493', 255, 20, 147], |
|
103
|
|
|
|
|
|
|
'deepskyblue' => ['#00bfff', 0, 191, 255], |
|
104
|
|
|
|
|
|
|
'dimgray' => ['#696969', 105, 105, 105], |
|
105
|
|
|
|
|
|
|
'dimgrey' => ['#696969', 105, 105, 105, 1], |
|
106
|
|
|
|
|
|
|
'dodgerblue' => ['#1e90ff', 30, 144, 255], |
|
107
|
|
|
|
|
|
|
'firebrick' => ['#b22222', 178, 34, 34], |
|
108
|
|
|
|
|
|
|
'floralwhite' => ['#fffaf0', 255, 250, 240], |
|
109
|
|
|
|
|
|
|
'forestgreen' => ['#228b22', 34, 139, 34], |
|
110
|
|
|
|
|
|
|
'fuchsia' => ['#ff00ff', 255, 0, 255], |
|
111
|
|
|
|
|
|
|
'gainsboro' => ['#dcdcdc', 220, 220, 220], |
|
112
|
|
|
|
|
|
|
'ghostwhite' => ['#f8f8ff', 248, 248, 255], |
|
113
|
|
|
|
|
|
|
'gold' => ['#ffd700', 255, 215, 0], |
|
114
|
|
|
|
|
|
|
'goldenrod' => ['#daa520', 218, 165, 32], |
|
115
|
|
|
|
|
|
|
'gray' => ['#808080', 128, 128, 128], |
|
116
|
|
|
|
|
|
|
'green' => ['#008000', 0, 128, 0], |
|
117
|
|
|
|
|
|
|
'greenyellow' => ['#adff2f', 173, 255, 47], |
|
118
|
|
|
|
|
|
|
'grey' => ['#808080', 128, 128, 128, 1], |
|
119
|
|
|
|
|
|
|
'honeydew' => ['#f0fff0', 240, 255, 240], |
|
120
|
|
|
|
|
|
|
'hotpink' => ['#ff69b4', 255, 105, 180], |
|
121
|
|
|
|
|
|
|
'indianred' => ['#cd5c5c', 205, 92, 92], |
|
122
|
|
|
|
|
|
|
'indigo' => ['#4b0082', 75, 0, 130], |
|
123
|
|
|
|
|
|
|
'ivory' => ['#fffff0', 255, 255, 240], |
|
124
|
|
|
|
|
|
|
'khaki' => ['#f0e68c', 240, 230, 140], |
|
125
|
|
|
|
|
|
|
'lavender' => ['#e6e6fa', 230, 230, 250], |
|
126
|
|
|
|
|
|
|
'lavenderblush' => ['#fff0f5', 255, 240, 245], |
|
127
|
|
|
|
|
|
|
'lawngreen' => ['#7cfc00', 124, 252, 0], |
|
128
|
|
|
|
|
|
|
'lemonchiffon' => ['#fffacd', 255, 250, 205], |
|
129
|
|
|
|
|
|
|
'lightblue' => ['#add8e6', 173, 216, 230], |
|
130
|
|
|
|
|
|
|
'lightcoral' => ['#f08080', 240, 128, 128], |
|
131
|
|
|
|
|
|
|
'lightcyan' => ['#e0ffff', 224, 255, 255], |
|
132
|
|
|
|
|
|
|
'lightgoldenrodyellow' => ['#fafad2', 250, 250, 210], |
|
133
|
|
|
|
|
|
|
'lightgray' => ['#d3d3d3', 211, 211, 211, 0], |
|
134
|
|
|
|
|
|
|
'lightgreen' => ['#90ee90', 144, 238, 144], |
|
135
|
|
|
|
|
|
|
'lightgrey' => ['#d3d3d3', 211, 211, 211, 1], |
|
136
|
|
|
|
|
|
|
'lightpink' => ['#ffb6c1', 255, 182, 193], |
|
137
|
|
|
|
|
|
|
'lightsalmon' => ['#ffa07a', 255, 160, 122], |
|
138
|
|
|
|
|
|
|
'lightseagreen' => ['#20b2aa', 32, 178, 170], |
|
139
|
|
|
|
|
|
|
'lightskyblue' => ['#87cefa', 135, 206, 250], |
|
140
|
|
|
|
|
|
|
'lightslategray' => ['#778899', 119, 136, 153], |
|
141
|
|
|
|
|
|
|
'lightslategrey' => ['#778899', 119, 136, 153, 1], |
|
142
|
|
|
|
|
|
|
'lightsteelblue' => ['#b0c4de', 176, 196, 222], |
|
143
|
|
|
|
|
|
|
'lightyellow' => ['#ffffe0', 255, 255, 224], |
|
144
|
|
|
|
|
|
|
'lime' => ['#00ff00', 0, 255, 0], |
|
145
|
|
|
|
|
|
|
'limegreen' => ['#32cd32', 50, 205, 50], |
|
146
|
|
|
|
|
|
|
'linen' => ['#faf0e6', 250, 240, 230], |
|
147
|
|
|
|
|
|
|
'magenta' => ['#ff00ff', 255, 0, 255, 1], |
|
148
|
|
|
|
|
|
|
'maroon' => ['#800000', 128, 0, 0], |
|
149
|
|
|
|
|
|
|
'mediumaquamarine' => ['#66cdaa', 102, 205, 170], |
|
150
|
|
|
|
|
|
|
'mediumblue' => ['#0000cd', 0, 0, 205], |
|
151
|
|
|
|
|
|
|
'mediumorchid' => ['#ba55d3', 186, 85, 211], |
|
152
|
|
|
|
|
|
|
'mediumpurple' => ['#9370db', 147, 112, 219], |
|
153
|
|
|
|
|
|
|
'mediumseagreen' => ['#3cb371', 60, 179, 113], |
|
154
|
|
|
|
|
|
|
'mediumslateblue' => ['#7b68ee', 123, 104, 238], |
|
155
|
|
|
|
|
|
|
'mediumspringgreen' => ['#00fa9a', 0, 250, 154], |
|
156
|
|
|
|
|
|
|
'mediumturquoise' => ['#48d1cc', 72, 209, 204], |
|
157
|
|
|
|
|
|
|
'mediumvioletred' => ['#c71585', 199, 21, 133], |
|
158
|
|
|
|
|
|
|
'midnightblue' => ['#191970', 25, 25 ,112], |
|
159
|
|
|
|
|
|
|
'mintcream' => ['#f5fffa', 245, 255, 250], |
|
160
|
|
|
|
|
|
|
'mistyrose' => ['#ffe4e1', 255, 228, 225], |
|
161
|
|
|
|
|
|
|
'moccasin' => ['#ffe4b5', 255, 228, 181], |
|
162
|
|
|
|
|
|
|
'navajowhite' => ['#ffdead', 255, 222, 173], |
|
163
|
|
|
|
|
|
|
'navy' => ['#000080', 0, 0, 128], |
|
164
|
|
|
|
|
|
|
'oldlace' => ['#fdf5e6', 253, 245, 230], |
|
165
|
|
|
|
|
|
|
'olive' => ['#808000', 128, 128, 0], |
|
166
|
|
|
|
|
|
|
'olivedrab' => ['#6b8e23', 107, 142, 35], |
|
167
|
|
|
|
|
|
|
'orange' => ['#ffa500', 255, 165, 0], |
|
168
|
|
|
|
|
|
|
'orangered' => ['#ff4500', 255, 69, 0], |
|
169
|
|
|
|
|
|
|
'orchid' => ['#da70d6', 218, 112, 214], |
|
170
|
|
|
|
|
|
|
'palegoldenrod' => ['#eee8aa', 238, 232, 170], |
|
171
|
|
|
|
|
|
|
'palegreen' => ['#98fb98', 152, 251, 152], |
|
172
|
|
|
|
|
|
|
'paleturquoise' => ['#afeeee', 175, 238, 238], |
|
173
|
|
|
|
|
|
|
'palevioletred' => ['#db7093', 219, 112, 147], |
|
174
|
|
|
|
|
|
|
'papayawhip' => ['#ffefd5', 255, 239, 213], |
|
175
|
|
|
|
|
|
|
'peachpuff' => ['#ffdab9', 255, 218, 185], |
|
176
|
|
|
|
|
|
|
'peru' => ['#cd853f', 205, 133, 63], |
|
177
|
|
|
|
|
|
|
'pink' => ['#ffc0cb', 255, 192, 203], |
|
178
|
|
|
|
|
|
|
'plum' => ['#dda0dd', 221, 160, 221], |
|
179
|
|
|
|
|
|
|
'powderblue' => ['#b0e0e6', 176, 224, 230], |
|
180
|
|
|
|
|
|
|
'purple' => ['#800080', 128, 0, 128], |
|
181
|
|
|
|
|
|
|
'red' => ['#ff0000', 255, 0, 0], |
|
182
|
|
|
|
|
|
|
'rosybrown' => ['#bc8f8f', 188, 143, 143], |
|
183
|
|
|
|
|
|
|
'royalblue' => ['#4169e1', 65, 105, 225], |
|
184
|
|
|
|
|
|
|
'saddlebrown' => ['#8b4513', 139, 69, 19], |
|
185
|
|
|
|
|
|
|
'salmon' => ['#fa8072', 250, 128, 114], |
|
186
|
|
|
|
|
|
|
'sandybrown' => ['#f4a460', 244, 164, 96], |
|
187
|
|
|
|
|
|
|
'seagreen' => ['#2e8b57', 46, 139, 87], |
|
188
|
|
|
|
|
|
|
'seashell' => ['#fff5ee', 255, 245, 238], |
|
189
|
|
|
|
|
|
|
'sienna' => ['#a0522d', 160, 82, 45], |
|
190
|
|
|
|
|
|
|
'silver' => ['#c0c0c0', 192, 192, 192], |
|
191
|
|
|
|
|
|
|
'skyblue' => ['#87ceeb', 135, 206, 235], |
|
192
|
|
|
|
|
|
|
'slateblue' => ['#6a5acd', 106, 90, 205], |
|
193
|
|
|
|
|
|
|
'slategray' => ['#708090', 112, 128, 144], |
|
194
|
|
|
|
|
|
|
'slategrey' => ['#708090', 112, 128, 144, 1], |
|
195
|
|
|
|
|
|
|
'snow' => ['#fffafa', 255, 250, 250], |
|
196
|
|
|
|
|
|
|
'springgreen' => ['#00ff7f', 0, 255, 127], |
|
197
|
|
|
|
|
|
|
'steelblue' => ['#4682b4', 70, 130, 180], |
|
198
|
|
|
|
|
|
|
'tan' => ['#d2b48c', 210, 180, 140], |
|
199
|
|
|
|
|
|
|
'teal' => ['#008080', 0, 128, 128], |
|
200
|
|
|
|
|
|
|
'thistle' => ['#d8bfd8', 216, 191, 216], |
|
201
|
|
|
|
|
|
|
'tomato' => ['#ff6347', 255, 99, 71], |
|
202
|
|
|
|
|
|
|
'turquoise' => ['#40e0d0', 64, 224, 208], |
|
203
|
|
|
|
|
|
|
'violet' => ['#ee82ee', 238, 130, 238], |
|
204
|
|
|
|
|
|
|
'wheat' => ['#f5deb3', 245, 222, 179], |
|
205
|
|
|
|
|
|
|
'white' => ['#ffffff', 255, 255, 255], |
|
206
|
|
|
|
|
|
|
'whitesmoke' => ['#f5f5f5', 245, 245, 245], |
|
207
|
|
|
|
|
|
|
'yellow' => ['#ffff00', 255, 255, 0], |
|
208
|
|
|
|
|
|
|
'yellowgreen' => ['#9acd32', 154, 205, 50 ] |
|
209
|
|
|
|
|
|
|
); |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
#################################################################################################### |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
# regular expression to find colors |
|
214
|
|
|
|
|
|
|
#************************************************************************************************** |
|
215
|
|
|
|
|
|
|
our $re_color_hex = qr/ |
|
216
|
|
|
|
|
|
|
\#[0-9A-F]{3,6} |
|
217
|
|
|
|
|
|
|
/xsi; |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
#################################################################################################### |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# match a color tripplet |
|
222
|
|
|
|
|
|
|
#************************************************************************************************** |
|
223
|
|
|
|
|
|
|
our $re_color_tripple = qr/ |
|
224
|
|
|
|
|
|
|
(?:$re_byte|$re_percent)\s*, |
|
225
|
|
|
|
|
|
|
\s*(?:$re_byte|$re_percent)\s*, |
|
226
|
|
|
|
|
|
|
\s*(?:$re_byte|$re_percent)\s* |
|
227
|
|
|
|
|
|
|
/xsi; |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# match the alpha channel value |
|
230
|
|
|
|
|
|
|
#************************************************************************************************** |
|
231
|
|
|
|
|
|
|
our $re_color_alpha = qr/ |
|
232
|
|
|
|
|
|
|
(?:$re_number|$re_percent) |
|
233
|
|
|
|
|
|
|
/xsi; |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
#################################################################################################### |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
# match for rgb color |
|
238
|
|
|
|
|
|
|
#************************************************************************************************** |
|
239
|
|
|
|
|
|
|
our $re_color_rgb = qr/ |
|
240
|
|
|
|
|
|
|
rgb\( |
|
241
|
|
|
|
|
|
|
$re_color_tripple |
|
242
|
|
|
|
|
|
|
\) |
|
243
|
|
|
|
|
|
|
/xsi; |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# match for rgba color |
|
246
|
|
|
|
|
|
|
#************************************************************************************************** |
|
247
|
|
|
|
|
|
|
our $re_color_rgba = qr/ |
|
248
|
|
|
|
|
|
|
rgba\( |
|
249
|
|
|
|
|
|
|
$re_color_tripple, |
|
250
|
|
|
|
|
|
|
$re_color_alpha |
|
251
|
|
|
|
|
|
|
\) |
|
252
|
|
|
|
|
|
|
/xsi; |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# match for hsl color |
|
255
|
|
|
|
|
|
|
#************************************************************************************************** |
|
256
|
|
|
|
|
|
|
our $re_color_hsl = qr/ |
|
257
|
|
|
|
|
|
|
hsl\( |
|
258
|
|
|
|
|
|
|
$re_color_tripple |
|
259
|
|
|
|
|
|
|
\) |
|
260
|
|
|
|
|
|
|
/xsi; |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
# match for hsla color |
|
263
|
|
|
|
|
|
|
#************************************************************************************************** |
|
264
|
|
|
|
|
|
|
our $re_color_hsla = qr/ |
|
265
|
|
|
|
|
|
|
hsla\( |
|
266
|
|
|
|
|
|
|
$re_color_tripple, |
|
267
|
|
|
|
|
|
|
$re_color_alpha |
|
268
|
|
|
|
|
|
|
\) |
|
269
|
|
|
|
|
|
|
/xsi; |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
#################################################################################################### |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
# create joined part for regular expressions |
|
274
|
|
|
|
|
|
|
#************************************************************************************************** |
|
275
|
|
|
|
|
|
|
my $color_ext = join('|', keys %color_ext); |
|
276
|
|
|
|
|
|
|
my $color_base = join('|', keys %color_base); |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
#************************************************************************************************** |
|
279
|
|
|
|
|
|
|
our $re_color_color_base = qr/ |
|
280
|
|
|
|
|
|
|
$color_base |
|
281
|
|
|
|
|
|
|
/xsi; |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
#************************************************************************************************** |
|
284
|
|
|
|
|
|
|
our $re_color_color_ext = qr/ |
|
285
|
|
|
|
|
|
|
$color_ext |
|
286
|
|
|
|
|
|
|
/xsi; |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
#************************************************************************************************** |
|
289
|
|
|
|
|
|
|
our $re_color_color = qr/ |
|
290
|
|
|
|
|
|
|
$re_color_color_base | |
|
291
|
|
|
|
|
|
|
$re_color_color_ext |
|
292
|
|
|
|
|
|
|
/xsi; |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
#################################################################################################### |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
# main regular expression for colors |
|
297
|
|
|
|
|
|
|
#************************************************************************************************** |
|
298
|
|
|
|
|
|
|
our $re_color = qr/(?: |
|
299
|
|
|
|
|
|
|
transparent | |
|
300
|
|
|
|
|
|
|
currentColor | |
|
301
|
|
|
|
|
|
|
$re_color_hex | |
|
302
|
|
|
|
|
|
|
$re_color_rgb | |
|
303
|
|
|
|
|
|
|
$re_color_rgba | |
|
304
|
|
|
|
|
|
|
$re_color_hsl | |
|
305
|
|
|
|
|
|
|
$re_color_hsla | |
|
306
|
|
|
|
|
|
|
$re_color_color |
|
307
|
|
|
|
|
|
|
)/xsi; |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
#################################################################################################### |
|
310
|
|
|
|
|
|
|
#################################################################################################### |
|
311
|
|
|
|
|
|
|
1; |