1pub fn parse(name: &str) -> Option<[u8; 4]> {
3 let s: String = name.chars().filter_map(|c|
4 match c {
5 'A'..='Z' => Some(c.to_ascii_lowercase()),
6 'a'..='z' => Some(c),
7 _ => None,
8 }
9 ).collect();
10 parse_flat_lower(&s)
11}
12
13pub fn parse_flat_lower(name: &str) -> Option<[u8; 4]> {
18 let value: u32 = match name{
19 "none" => 0x00000000,
20 "transparent" => 0x00000000,
21 "aliceblue" => 0xf0f8ffff,
22 "antiquewhite" => 0xfaebd7ff,
23 "aqua" => 0x00ffffff,
24 "aquamarine" => 0x7fffd4ff,
25 "azure" => 0xf0ffffff,
26 "beige" => 0xf5f5dcff,
27 "bisque" => 0xffe4c4ff,
28 "black" => 0x000000ff,
29 "blanchedalmond" => 0xffebcdff,
30 "blue" => 0x0000ffff,
31 "blueviolet" => 0x8a2be2ff,
32 "brown" => 0xa52a2aff,
33 "burlywood" => 0xdeb887ff,
34 "cadetblue" => 0x5f9ea0ff,
35 "chartreuse" => 0x7fff00ff,
36 "chocolate" => 0xd2691eff,
37 "coral" => 0xff7f50ff,
38 "cornflowerblue" => 0x6495edff,
39 "cornsilk" => 0xfff8dcff,
40 "crimson" => 0xdc143cff,
41 "cyan" => 0x00ffffff,
42 "darkblue" => 0x00008bff,
43 "darkcyan" => 0x008b8bff,
44 "darkgoldenrod" => 0xb8860bff,
45 "darkgray" => 0xa9a9a9ff,
46 "darkgreen" => 0x006400ff,
47 "darkgrey" => 0xa9a9a9ff,
48 "darkkhaki" => 0xbdb76bff,
49 "darkmagenta" => 0x8b008bff,
50 "darkolivegreen" => 0x556b2fff,
51 "darkorange" => 0xff8c00ff,
52 "darkorchid" => 0x9932ccff,
53 "darkred" => 0x8b0000ff,
54 "darksalmon" => 0xe9967aff,
55 "darkseagreen" => 0x8fbc8fff,
56 "darkslateblue" => 0x483d8bff,
57 "darkslategray" => 0x2f4f4fff,
58 "darkslategrey" => 0x2f4f4fff,
59 "darkturquoise" => 0x00ced1ff,
60 "darkviolet" => 0x9400d3ff,
61 "deeppink" => 0xff1493ff,
62 "deepskyblue" => 0x00bfffff,
63 "dimgray" => 0x696969ff,
64 "dimgrey" => 0x696969ff,
65 "dodgerblue" => 0x1e90ffff,
66 "firebrick" => 0xb22222ff,
67 "floralwhite" => 0xfffaf0ff,
68 "forestgreen" => 0x228b22ff,
69 "fuchsia" => 0xff00ffff,
70 "gainsboro" => 0xdcdcdcff,
71 "ghostwhite" => 0xf8f8ffff,
72 "gold" => 0xffd700ff,
73 "goldenrod" => 0xdaa520ff,
74 "gray" => 0x808080ff,
75 "green" => 0x008000ff,
76 "greenyellow" => 0xadff2fff,
77 "grey" => 0x808080ff,
78 "honeydew" => 0xf0fff0ff,
79 "hotpink" => 0xff69b4ff,
80 "indianred" => 0xcd5c5cff,
81 "indigo" => 0x4b0082ff,
82 "ivory" => 0xfffff0ff,
83 "khaki" => 0xf0e68cff,
84 "lavender" => 0xe6e6faff,
85 "lavenderblush" => 0xfff0f5ff,
86 "lawngreen" => 0x7cfc00ff,
87 "lemonchiffon" => 0xfffacdff,
88 "lightblue" => 0xadd8e6ff,
89 "lightcoral" => 0xf08080ff,
90 "lightcyan" => 0xe0ffffff,
91 "lightgoldenrodyellow" => 0xfafad2ff,
92 "lightgray" => 0xd3d3d3ff,
93 "lightgreen" => 0x90ee90ff,
94 "lightgrey" => 0xd3d3d3ff,
95 "lightpink" => 0xffb6c1ff,
96 "lightsalmon" => 0xffa07aff,
97 "lightseagreen" => 0x20b2aaff,
98 "lightskyblue" => 0x87cefaff,
99 "lightslategray" => 0x778899ff,
100 "lightslategrey" => 0x778899ff,
101 "lightsteelblue" => 0xb0c4deff,
102 "lightyellow" => 0xffffe0ff,
103 "lime" => 0x00ff00ff,
104 "limegreen" => 0x32cd32ff,
105 "linen" => 0xfaf0e6ff,
106 "magenta" => 0xff00ffff,
107 "maroon" => 0x800000ff,
108 "mediumaquamarine" => 0x66cdaaff,
109 "mediumblue" => 0x0000cdff,
110 "mediumorchid" => 0xba55d3ff,
111 "mediumpurple" => 0x9370dbff,
112 "mediumseagreen" => 0x3cb371ff,
113 "mediumslateblue" => 0x7b68eeff,
114 "mediumspringgreen" => 0x00fa9aff,
115 "mediumturquoise" => 0x48d1ccff,
116 "mediumvioletred" => 0xc71585ff,
117 "midnightblue" => 0x191970ff,
118 "mintcream" => 0xf5fffaff,
119 "mistyrose" => 0xffe4e1ff,
120 "moccasin" => 0xffe4b5ff,
121 "navajowhite" => 0xffdeadff,
122 "navy" => 0x000080ff,
123 "oldlace" => 0xfdf5e6ff,
124 "olive" => 0x808000ff,
125 "olivedrab" => 0x6b8e23ff,
126 "orange" => 0xffa500ff,
127 "orangered" => 0xff4500ff,
128 "orchid" => 0xda70d6ff,
129 "palegoldenrod" => 0xeee8aaff,
130 "palegreen" => 0x98fb98ff,
131 "paleturquoise" => 0xafeeeeff,
132 "palevioletred" => 0xdb7093ff,
133 "papayawhip" => 0xffefd5ff,
134 "peachpuff" => 0xffdab9ff,
135 "peru" => 0xcd853fff,
136 "pink" => 0xffc0cbff,
137 "plum" => 0xdda0ddff,
138 "powderblue" => 0xb0e0e6ff,
139 "purple" => 0x800080ff,
140 "rebeccapurple" => 0x663399ff,
141 "red" => 0xff0000ff,
142 "rosybrown" => 0xbc8f8fff,
143 "royalblue" => 0x4169e1ff,
144 "saddlebrown" => 0x8b4513ff,
145 "salmon" => 0xfa8072ff,
146 "sandybrown" => 0xf4a460ff,
147 "seagreen" => 0x2e8b57ff,
148 "seashell" => 0xfff5eeff,
149 "sienna" => 0xa0522dff,
150 "silver" => 0xc0c0c0ff,
151 "skyblue" => 0x87ceebff,
152 "slateblue" => 0x6a5acdff,
153 "slategray" => 0x708090ff,
154 "slategrey" => 0x708090ff,
155 "snow" => 0xfffafaff,
156 "springgreen" => 0x00ff7fff,
157 "steelblue" => 0x4682b4ff,
158 "tan" => 0xd2b48cff,
159 "teal" => 0x008080ff,
160 "thistle" => 0xd8bfd8ff,
161 "tomato" => 0xff6347ff,
162 "turquoise" => 0x40e0d0ff,
163 "violet" => 0xee82eeff,
164 "wheat" => 0xf5deb3ff,
165 "white" => 0xffffffff,
166 "whitesmoke" => 0xf5f5f5ff,
167 "yellow" => 0xffff00ff,
168 "yellowgreen" => 0x9acd32,
169 _ => return None,
170 };
171 Some(value.to_be_bytes())
172}