1
use approx::relative_eq;
2
use easygpu::color::{Rgba, Rgba8};
3
use palette::rgb::Srgba;
4
use palette::stimulus::IntoStimulus;
5
use palette::{Darken, Lighten, Srgb};
6

            
7
/// A RGBA color with f32 components.
8
9
#[derive(Default, Clone, Debug, Copy, PartialEq)]
9
pub struct Color(Rgba);
10

            
11
impl<U> From<Srgba<U>> for Color
12
where
13
    U: IntoStimulus<f32>,
14
{
15
    fn from(color: Srgba<U>) -> Self {
16
        let color = color.into_format::<_, f32>();
17
        Self(Rgba {
18
            r: color.color.red,
19
            g: color.color.green,
20
            b: color.color.blue,
21
            a: color.alpha,
22
        })
23
    }
24
}
25

            
26
impl<U> From<Srgb<U>> for Color
27
where
28
    U: IntoStimulus<f32>,
29
{
30
    fn from(color: Srgb<U>) -> Self {
31
        let color = color.into_format::<f32>();
32
        Self(Rgba {
33
            r: color.red,
34
            g: color.green,
35
            b: color.blue,
36
            a: 1.,
37
        })
38
    }
39
}
40

            
41
impl From<Color> for Srgba {
42
    fn from(color: Color) -> Self {
43
        Self::new(color.0.r, color.0.g, color.0.b, color.0.a)
44
    }
45
}
46

            
47
impl From<Color> for Rgba {
48
    fn from(color: Color) -> Self {
49
        color.0
50
    }
51
}
52

            
53
impl From<Rgba> for Color {
54
    fn from(color: Rgba) -> Self {
55
        Self(color)
56
    }
57
}
58

            
59
impl From<Color> for Rgba8 {
60
    fn from(color: Color) -> Self {
61
        color.0.into()
62
    }
63
}
64

            
65
impl Color {
66
    #[must_use]
67
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
68
    pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Self {
69
        Self(Rgba { r, g, b, a })
70
    }
71

            
72
    /// Lightens the color by `amount`.
73
    #[must_use]
74
    pub fn lighten(self, amount: f32) -> Self {
75
        let color: Srgba = self.into();
76
        let linear = color.into_linear();
77
        Srgba::<f32>::from_linear(linear.lighten(amount)).into()
78
    }
79

            
80
    /// Darkens the color by `amount`.
81
    #[must_use]
82
    pub fn darken(self, amount: f32) -> Self {
83
        let color: Srgba = self.into();
84
        let linear = color.into_linear();
85
        Srgba::<f32>::from_linear(linear.darken(amount)).into()
86
    }
87

            
88
    /// Returns the red component.
89
    #[must_use]
90
    pub const fn red(&self) -> f32 {
91
        self.0.r
92
    }
93

            
94
    /// Returns the green component.
95
    #[must_use]
96
    pub const fn green(&self) -> f32 {
97
        self.0.g
98
    }
99

            
100
    /// Returns the blue component.
101
    #[must_use]
102
    pub const fn blue(&self) -> f32 {
103
        self.0.b
104
    }
105

            
106
    /// Returns the alpha component.
107
    #[must_use]
108
    pub const fn alpha(&self) -> f32 {
109
        self.0.a
110
    }
111

            
112
    /// Returns the color as an f32 array.
113
    #[must_use]
114
3
    pub const fn rgba(&self) -> [f32; 4] {
115
3
        [self.0.r, self.0.g, self.0.b, self.0.a]
116
3
    }
117

            
118
    /// Returns if the color has a non-zero alpha value.
119
    #[must_use]
120
    pub fn visible(&self) -> bool {
121
        !relative_eq!(self.0.a, 0.)
122
    }
123

            
124
    /// Returns a new color using red, green, and blue from `self` and the
125
    /// parameter `alpha`.
126
    #[must_use]
127
    pub const fn with_alpha(mut self, alpha: f32) -> Self {
128
        self.0.a = alpha;
129
        self
130
    }
131
}
132

            
133
impl Color {
134
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
135
    pub const ALICEBLUE: Self = Self::new(240. / 255., 248. / 255., 1., 1.);
136
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
137
    pub const ANTIQUEWHITE: Self = Self::new(250. / 255., 235. / 255., 215. / 255., 1.);
138
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
139
    pub const AQUA: Self = Self::new(0., 1., 1., 1.);
140
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
141
    pub const AQUAMARINE: Self = Self::new(127. / 255., 1., 212. / 255., 1.);
142
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
143
    pub const AZURE: Self = Self::new(240. / 255., 1., 1., 1.);
144
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
145
    pub const BEIGE: Self = Self::new(245. / 255., 245. / 255., 220. / 255., 1.);
146
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
147
    pub const BISQUE: Self = Self::new(1., 228. / 255., 196. / 255., 1.);
148
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
149
    pub const BLACK: Self = Self::new(0., 0., 0., 1.);
150
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
151
    pub const BLANCHEDALMOND: Self = Self::new(1., 235. / 255., 205. / 255., 1.);
152
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
153
    pub const BLUE: Self = Self::new(0., 0., 1., 1.);
154
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
155
    pub const BLUEVIOLET: Self = Self::new(138. / 255., 43. / 255., 226. / 255., 1.);
156
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
157
    pub const BROWN: Self = Self::new(165. / 255., 42. / 255., 42. / 255., 1.);
158
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
159
    pub const BURLYWOOD: Self = Self::new(222. / 255., 184. / 255., 135. / 255., 1.);
160
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
161
    pub const CADETBLUE: Self = Self::new(95. / 255., 158. / 255., 160. / 255., 1.);
162
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
163
    pub const CHARTREUSE: Self = Self::new(127. / 255., 1., 0., 1.);
164
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
165
    pub const CHOCOLATE: Self = Self::new(210. / 255., 105. / 255., 30. / 255., 1.);
166
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
167
    pub const CLEAR_BLACK: Self = Self::new(0., 0., 0., 0.);
168
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
169
    pub const CLEAR_WHITE: Self = Self::new(1., 1., 1., 0.);
170
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
171
    pub const CORAL: Self = Self::new(1., 127. / 255., 80. / 255., 1.);
172
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
173
    pub const CORNFLOWERBLUE: Self = Self::new(100. / 255., 149. / 255., 237. / 255., 1.);
174
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
175
    pub const CORNSILK: Self = Self::new(1., 248. / 255., 220. / 255., 1.);
176
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
177
    pub const CRIMSON: Self = Self::new(220. / 255., 20. / 255., 60. / 255., 1.);
178
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
179
    pub const CYAN: Self = Self::new(0., 1., 1., 1.);
180
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
181
    pub const DARKBLUE: Self = Self::new(0., 0., 139. / 255., 1.);
182
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
183
    pub const DARKCYAN: Self = Self::new(0., 139. / 255., 139. / 255., 1.);
184
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
185
    pub const DARKGOLDENROD: Self = Self::new(184. / 255., 134. / 255., 11. / 255., 1.);
186
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
187
    pub const DARKGRAY: Self = Self::new(169. / 255., 169. / 255., 169. / 255., 1.);
188
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
189
    pub const DARKGREEN: Self = Self::new(0., 100. / 255., 0., 1.);
190
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
191
    pub const DARKGREY: Self = Self::new(169. / 255., 169. / 255., 169. / 255., 1.);
192
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
193
    pub const DARKKHAKI: Self = Self::new(189. / 255., 183. / 255., 107. / 255., 1.);
194
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
195
    pub const DARKMAGENTA: Self = Self::new(139. / 255., 0., 139. / 255., 1.);
196
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
197
    pub const DARKOLIVEGREEN: Self = Self::new(85. / 255., 107. / 255., 47. / 255., 1.);
198
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
199
    pub const DARKORANGE: Self = Self::new(1., 140. / 255., 0., 1.);
200
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
201
    pub const DARKORCHID: Self = Self::new(153. / 255., 50. / 255., 204. / 255., 1.);
202
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
203
    pub const DARKRED: Self = Self::new(139. / 255., 0., 0., 1.);
204
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
205
    pub const DARKSALMON: Self = Self::new(233. / 255., 150. / 255., 122. / 255., 1.);
206
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
207
    pub const DARKSEAGREEN: Self = Self::new(143. / 255., 188. / 255., 143. / 255., 1.);
208
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
209
    pub const DARKSLATEBLUE: Self = Self::new(72. / 255., 61. / 255., 139. / 255., 1.);
210
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
211
    pub const DARKSLATEGRAY: Self = Self::new(47. / 255., 79. / 255., 79. / 255., 1.);
212
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
213
    pub const DARKSLATEGREY: Self = Self::new(47. / 255., 79. / 255., 79. / 255., 1.);
214
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
215
    pub const DARKTURQUOISE: Self = Self::new(0., 206. / 255., 209. / 255., 1.);
216
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
217
    pub const DARKVIOLET: Self = Self::new(148. / 255., 0., 211. / 255., 1.);
218
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
219
    pub const DEEPPINK: Self = Self::new(1., 20. / 255., 147. / 255., 1.);
220
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
221
    pub const DEEPSKYBLUE: Self = Self::new(0., 191. / 255., 1., 1.);
222
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
223
    pub const DIMGRAY: Self = Self::new(105. / 255., 105. / 255., 105. / 255., 1.);
224
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
225
    pub const DIMGREY: Self = Self::new(105. / 255., 105. / 255., 105. / 255., 1.);
226
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
227
    pub const DODGERBLUE: Self = Self::new(30. / 255., 144. / 255., 1., 1.);
228
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
229
    pub const FIREBRICK: Self = Self::new(178. / 255., 34. / 255., 34. / 255., 1.);
230
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
231
    pub const FLORALWHITE: Self = Self::new(1., 250. / 255., 240. / 255., 1.);
232
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
233
    pub const FORESTGREEN: Self = Self::new(34. / 255., 139. / 255., 34. / 255., 1.);
234
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
235
    pub const FUCHSIA: Self = Self::new(1., 0., 1., 1.);
236
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
237
    pub const GAINSBORO: Self = Self::new(220. / 255., 220. / 255., 220. / 255., 1.);
238
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
239
    pub const GHOSTWHITE: Self = Self::new(248. / 255., 248. / 255., 1., 1.);
240
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
241
    pub const GOLD: Self = Self::new(1., 215. / 255., 0., 1.);
242
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
243
    pub const GOLDENROD: Self = Self::new(218. / 255., 165. / 255., 32. / 255., 1.);
244
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
245
    pub const GRAY: Self = Self::new(128. / 255., 128. / 255., 128. / 255., 1.);
246
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
247
    pub const GREEN: Self = Self::new(0., 128. / 255., 0., 1.);
248
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
249
    pub const GREENYELLOW: Self = Self::new(173. / 255., 1., 47. / 255., 1.);
250
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
251
    pub const GREY: Self = Self::new(128. / 255., 128. / 255., 128. / 255., 1.);
252
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
253
    pub const HONEYDEW: Self = Self::new(240. / 255., 1., 240. / 255., 1.);
254
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
255
    pub const HOTPINK: Self = Self::new(1., 105. / 255., 180. / 255., 1.);
256
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
257
    pub const INDIANRED: Self = Self::new(205. / 255., 92. / 255., 92. / 255., 1.);
258
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
259
    pub const INDIGO: Self = Self::new(75. / 255., 0., 130. / 255., 1.);
260
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
261
    pub const IVORY: Self = Self::new(1., 1., 240. / 255., 1.);
262
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
263
    pub const KHAKI: Self = Self::new(240. / 255., 230. / 255., 140. / 255., 1.);
264
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
265
    pub const LAVENDER: Self = Self::new(230. / 255., 230. / 255., 250. / 255., 1.);
266
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
267
    pub const LAVENDERBLUSH: Self = Self::new(1., 240. / 255., 245. / 255., 1.);
268
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
269
    pub const LAWNGREEN: Self = Self::new(124. / 255., 252. / 255., 0., 1.);
270
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
271
    pub const LEMONCHIFFON: Self = Self::new(1., 250. / 255., 205. / 255., 1.);
272
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
273
    pub const LIGHTBLUE: Self = Self::new(173. / 255., 216. / 255., 230. / 255., 1.);
274
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
275
    pub const LIGHTCORAL: Self = Self::new(240. / 255., 128. / 255., 128. / 255., 1.);
276
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
277
    pub const LIGHTCYAN: Self = Self::new(224. / 255., 1., 1., 1.);
278
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
279
    pub const LIGHTGOLDENRODYELLOW: Self = Self::new(250. / 255., 250. / 255., 210. / 255., 1.);
280
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
281
    pub const LIGHTGRAY: Self = Self::new(211. / 255., 211. / 255., 211. / 255., 1.);
282
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
283
    pub const LIGHTGREEN: Self = Self::new(144. / 255., 238. / 255., 144. / 255., 1.);
284
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
285
    pub const LIGHTGREY: Self = Self::new(211. / 255., 211. / 255., 211. / 255., 1.);
286
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
287
    pub const LIGHTPINK: Self = Self::new(1., 182. / 255., 193. / 255., 1.);
288
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
289
    pub const LIGHTSALMON: Self = Self::new(1., 160. / 255., 122. / 255., 1.);
290
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
291
    pub const LIGHTSEAGREEN: Self = Self::new(32. / 255., 178. / 255., 170. / 255., 1.);
292
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
293
    pub const LIGHTSKYBLUE: Self = Self::new(135. / 255., 206. / 255., 250. / 255., 1.);
294
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
295
    pub const LIGHTSLATEGRAY: Self = Self::new(119. / 255., 136. / 255., 153. / 255., 1.);
296
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
297
    pub const LIGHTSLATEGREY: Self = Self::new(119. / 255., 136. / 255., 153. / 255., 1.);
298
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
299
    pub const LIGHTSTEELBLUE: Self = Self::new(176. / 255., 196. / 255., 222. / 255., 1.);
300
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
301
    pub const LIGHTYELLOW: Self = Self::new(1., 1., 224. / 255., 1.);
302
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
303
    pub const LIME: Self = Self::new(0., 1., 0., 1.);
304
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
305
    pub const LIMEGREEN: Self = Self::new(50. / 255., 205. / 255., 50. / 255., 1.);
306
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
307
    pub const LINEN: Self = Self::new(250. / 255., 240. / 255., 230. / 255., 1.);
308
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
309
    pub const MAGENTA: Self = Self::new(1., 0., 1., 1.);
310
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
311
    pub const MAROON: Self = Self::new(128. / 255., 0., 0., 1.);
312
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
313
    pub const MEDIUMAQUAMARINE: Self = Self::new(102. / 255., 205. / 255., 170. / 255., 1.);
314
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
315
    pub const MEDIUMBLUE: Self = Self::new(0., 0., 205. / 255., 1.);
316
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
317
    pub const MEDIUMORCHID: Self = Self::new(186. / 255., 85. / 255., 211. / 255., 1.);
318
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
319
    pub const MEDIUMPURPLE: Self = Self::new(147. / 255., 112. / 255., 219. / 255., 1.);
320
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
321
    pub const MEDIUMSEAGREEN: Self = Self::new(60. / 255., 179. / 255., 113. / 255., 1.);
322
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
323
    pub const MEDIUMSLATEBLUE: Self = Self::new(123. / 255., 104. / 255., 238. / 255., 1.);
324
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
325
    pub const MEDIUMSPRINGGREEN: Self = Self::new(0., 250. / 255., 154. / 255., 1.);
326
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
327
    pub const MEDIUMTURQUOISE: Self = Self::new(72. / 255., 209. / 255., 204. / 255., 1.);
328
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
329
    pub const MEDIUMVIOLETRED: Self = Self::new(199. / 255., 21. / 255., 133. / 255., 1.);
330
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
331
    pub const MIDNIGHTBLUE: Self = Self::new(25. / 255., 25. / 255., 112. / 255., 1.);
332
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
333
    pub const MINTCREAM: Self = Self::new(245. / 255., 1., 250. / 255., 1.);
334
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
335
    pub const MISTYROSE: Self = Self::new(1., 228. / 255., 225. / 255., 1.);
336
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
337
    pub const MOCCASIN: Self = Self::new(1., 228. / 255., 181. / 255., 1.);
338
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
339
    pub const NAVAJOWHITE: Self = Self::new(1., 222. / 255., 173. / 255., 1.);
340
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
341
    pub const NAVY: Self = Self::new(0., 0., 128. / 255., 1.);
342
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
343
    pub const OLDLACE: Self = Self::new(253. / 255., 245. / 255., 230. / 255., 1.);
344
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
345
    pub const OLIVE: Self = Self::new(128. / 255., 128. / 255., 0., 1.);
346
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
347
    pub const OLIVEDRAB: Self = Self::new(107. / 255., 142. / 255., 35. / 255., 1.);
348
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
349
    pub const ORANGE: Self = Self::new(1., 165. / 255., 0., 1.);
350
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
351
    pub const ORANGERED: Self = Self::new(1., 69. / 255., 0., 1.);
352
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
353
    pub const ORCHID: Self = Self::new(218. / 255., 112. / 255., 214. / 255., 1.);
354
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
355
    pub const PALEGOLDENROD: Self = Self::new(238. / 255., 232. / 255., 170. / 255., 1.);
356
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
357
    pub const PALEGREEN: Self = Self::new(152. / 255., 251. / 255., 152. / 255., 1.);
358
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
359
    pub const PALETURQUOISE: Self = Self::new(175. / 255., 238. / 255., 238. / 255., 1.);
360
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
361
    pub const PALEVIOLETRED: Self = Self::new(219. / 255., 112. / 255., 147. / 255., 1.);
362
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
363
    pub const PAPAYAWHIP: Self = Self::new(1., 239. / 255., 213. / 255., 1.);
364
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
365
    pub const PEACHPUFF: Self = Self::new(1., 218. / 255., 185. / 255., 1.);
366
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
367
    pub const PERU: Self = Self::new(205. / 255., 133. / 255., 63. / 255., 1.);
368
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
369
    pub const PINK: Self = Self::new(1., 192. / 255., 203. / 255., 1.);
370
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
371
    pub const PLUM: Self = Self::new(221. / 255., 160. / 255., 221. / 255., 1.);
372
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
373
    pub const POWDERBLUE: Self = Self::new(176. / 255., 224. / 255., 230. / 255., 1.);
374
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
375
    pub const PURPLE: Self = Self::new(128. / 255., 0., 128. / 255., 1.);
376
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
377
    pub const REBECCAPURPLE: Self = Self::new(102. / 255., 51. / 255., 153. / 255., 1.);
378
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
379
    pub const RED: Self = Self::new(1., 0., 0., 1.);
380
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
381
    pub const ROSYBROWN: Self = Self::new(188. / 255., 143. / 255., 143. / 255., 1.);
382
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
383
    pub const ROYALBLUE: Self = Self::new(65. / 255., 105. / 255., 225. / 255., 1.);
384
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
385
    pub const SADDLEBROWN: Self = Self::new(139. / 255., 69. / 255., 19. / 255., 1.);
386
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
387
    pub const SALMON: Self = Self::new(250. / 255., 128. / 255., 114. / 255., 1.);
388
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
389
    pub const SANDYBROWN: Self = Self::new(244. / 255., 164. / 255., 96. / 255., 1.);
390
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
391
    pub const SEAGREEN: Self = Self::new(46. / 255., 139. / 255., 87. / 255., 1.);
392
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
393
    pub const SEASHELL: Self = Self::new(1., 245. / 255., 238. / 255., 1.);
394
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
395
    pub const SIENNA: Self = Self::new(160. / 255., 82. / 255., 45. / 255., 1.);
396
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
397
    pub const SILVER: Self = Self::new(192. / 255., 192. / 255., 192. / 255., 1.);
398
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
399
    pub const SKYBLUE: Self = Self::new(135. / 255., 206. / 255., 235. / 255., 1.);
400
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
401
    pub const SLATEBLUE: Self = Self::new(106. / 255., 90. / 255., 205. / 255., 1.);
402
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
403
    pub const SLATEGRAY: Self = Self::new(112. / 255., 128. / 255., 144. / 255., 1.);
404
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
405
    pub const SLATEGREY: Self = Self::new(112. / 255., 128. / 255., 144. / 255., 1.);
406
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
407
    pub const SNOW: Self = Self::new(1., 250. / 255., 250. / 255., 1.);
408
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
409
    pub const SPRINGGREEN: Self = Self::new(0., 1., 127. / 255., 1.);
410
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
411
    pub const STEELBLUE: Self = Self::new(70. / 255., 130. / 255., 180. / 255., 1.);
412
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
413
    pub const TAN: Self = Self::new(210. / 255., 180. / 255., 140. / 255., 1.);
414
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
415
    pub const TEAL: Self = Self::new(0., 128. / 255., 128. / 255., 1.);
416
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
417
    pub const THISTLE: Self = Self::new(216. / 255., 191. / 255., 216. / 255., 1.);
418
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
419
    pub const TOMATO: Self = Self::new(1., 99. / 255., 71. / 255., 1.);
420
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
421
    pub const TURQUOISE: Self = Self::new(64. / 255., 224. / 255., 208. / 255., 1.);
422
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
423
    pub const VIOLET: Self = Self::new(238. / 255., 130. / 255., 238. / 255., 1.);
424
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
425
    pub const WHEAT: Self = Self::new(245. / 255., 222. / 255., 179. / 255., 1.);
426
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
427
    pub const WHITE: Self = Self::new(1., 1., 1., 1.);
428
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
429
    pub const WHITESMOKE: Self = Self::new(245. / 255., 245. / 255., 245. / 255., 1.);
430
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
431
    pub const YELLOW: Self = Self::new(1., 1., 0., 1.);
432
    /// Equivalent to the [CSS color keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the same name.
433
    pub const YELLOWGREEN: Self = Self::new(154. / 255., 205. / 255., 50. / 255., 1.);
434
}