001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.wpilibj.util;
006
007import edu.wpi.first.math.MathUtil;
008import java.util.Objects;
009
010/**
011 * Represents colors.
012 *
013 * <p>Limited to 12 bits of precision.
014 */
015@SuppressWarnings("MemberName")
016public class Color {
017  /** Red component (0-1). */
018  public final double red;
019
020  /** Green component (0-1). */
021  public final double green;
022
023  /** Blue component (0-1). */
024  public final double blue;
025
026  private String m_name;
027
028  /** Constructs a default color (black). */
029  public Color() {
030    red = 0.0;
031    green = 0.0;
032    blue = 0.0;
033  }
034
035  /**
036   * Constructs a Color from doubles.
037   *
038   * @param red Red value (0-1)
039   * @param green Green value (0-1)
040   * @param blue Blue value (0-1)
041   */
042  public Color(double red, double green, double blue) {
043    this.red = roundAndClamp(red);
044    this.green = roundAndClamp(green);
045    this.blue = roundAndClamp(blue);
046    this.m_name = null;
047  }
048
049  /**
050   * Constructs a Color from ints.
051   *
052   * @param red Red value (0-255)
053   * @param green Green value (0-255)
054   * @param blue Blue value (0-255)
055   */
056  public Color(int red, int green, int blue) {
057    this(red / 255.0, green / 255.0, blue / 255.0);
058  }
059
060  /**
061   * Constructs a Color from a Color8Bit.
062   *
063   * @param color The color
064   */
065  public Color(Color8Bit color) {
066    this(color.red / 255.0, color.green / 255.0, color.blue / 255.0);
067  }
068
069  /**
070   * Constructs a Color from doubles.
071   *
072   * @param red Red value (0-1)
073   * @param green Green value (0-1)
074   * @param blue Blue value (0-1)
075   */
076  private Color(double red, double green, double blue, String name) {
077    this.red = roundAndClamp(red);
078    this.green = roundAndClamp(green);
079    this.blue = roundAndClamp(blue);
080    this.m_name = name;
081  }
082
083  /**
084   * Constructs a Color from a hex string.
085   *
086   * @param hexString a string of the format <code>#RRGGBB</code>
087   * @throws IllegalArgumentException if the hex string is invalid.
088   */
089  public Color(String hexString) {
090    if (hexString.length() != 7 || !hexString.startsWith("#")) {
091      throw new IllegalArgumentException("Invalid hex string \"" + hexString + "\"");
092    }
093
094    this.red = Integer.valueOf(hexString.substring(1, 3), 16) / 255.0;
095    this.green = Integer.valueOf(hexString.substring(3, 5), 16) / 255.0;
096    this.blue = Integer.valueOf(hexString.substring(5, 7), 16) / 255.0;
097  }
098
099  /**
100   * Creates a Color from HSV values.
101   *
102   * @param h The h value [0-180)
103   * @param s The s value [0-255]
104   * @param v The v value [0-255]
105   * @return The color
106   */
107  public static Color fromHSV(int h, int s, int v) {
108    int rgb = hsvToRgb(h, s, v);
109    return new Color(
110        unpackRGB(rgb, RGBChannel.kRed),
111        unpackRGB(rgb, RGBChannel.kGreen),
112        unpackRGB(rgb, RGBChannel.kBlue));
113  }
114
115  @Override
116  public boolean equals(Object other) {
117    if (this == other) {
118      return true;
119    }
120    if (other == null) {
121      return false;
122    }
123
124    return other instanceof Color color
125        && Double.compare(color.red, red) == 0
126        && Double.compare(color.green, green) == 0
127        && Double.compare(color.blue, blue) == 0;
128  }
129
130  @Override
131  public int hashCode() {
132    return Objects.hash(red, green, blue);
133  }
134
135  @Override
136  public String toString() {
137    if (m_name == null) {
138      // cache hex conversion
139      m_name = toHexString();
140    }
141    return m_name;
142  }
143
144  /**
145   * Return this color represented as a hex string.
146   *
147   * @return a string of the format <code>#RRGGBB</code>
148   */
149  public String toHexString() {
150    return String.format(
151        "#%02X%02X%02X", (int) (red * 255), (int) (green * 255), (int) (blue * 255));
152  }
153
154  private static double roundAndClamp(double value) {
155    return MathUtil.clamp(Math.ceil(value * (1 << 12)) / (1 << 12), 0.0, 1.0);
156  }
157
158  // Helper methods
159
160  /**
161   * Converts HSV values to RGB values. The returned RGB color is packed into a 32-bit integer for
162   * memory performance reasons.
163   *
164   * @param h The h value [0-180)
165   * @param s The s value [0-255]
166   * @param v The v value [0-255]
167   * @return the packed RGB color
168   */
169  public static int hsvToRgb(int h, int s, int v) {
170    // Loosely based on
171    // https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB
172    // The hue range is split into 60 degree regions where in each region there
173    // is one rgb component at a low value (m), one at a high value (v) and one
174    // that changes (X) from low to high (X+m) or high to low (v-X)
175
176    // Difference between highest and lowest value of any rgb component
177    final int chroma = (s * v) / 255;
178
179    // Because hue is 0-180 rather than 0-360 use 30 not 60
180    final int region = (h / 30) % 6;
181
182    // Remainder converted from 0-30 to 0-255
183    final int remainder = (int) Math.round((h % 30) * (255 / 30.0));
184
185    // Value of the lowest rgb component
186    final int m = v - chroma;
187
188    // Goes from 0 to chroma as hue increases
189    final int X = (chroma * remainder) >> 8;
190
191    int red;
192    int green;
193    int blue;
194    switch (region) {
195      case 0:
196        red = v;
197        green = X + m;
198        blue = m;
199        break;
200      case 1:
201        red = v - X;
202        green = v;
203        blue = m;
204        break;
205      case 2:
206        red = m;
207        green = v;
208        blue = X + m;
209        break;
210      case 3:
211        red = m;
212        green = v - X;
213        blue = v;
214        break;
215      case 4:
216        red = X + m;
217        green = m;
218        blue = v;
219        break;
220      default:
221        red = v;
222        green = m;
223        blue = v - X;
224        break;
225    }
226    return packRGB(red, green, blue);
227  }
228
229  /** Represents a color channel in an RGB color. */
230  public enum RGBChannel {
231    /** The red channel of an RGB color. */
232    kRed,
233    /** The green channel of an RGB color. */
234    kGreen,
235    /** The blue channel of an RGB color. */
236    kBlue
237  }
238
239  /**
240   * Packs 3 RGB values into a single 32-bit integer. These values can be unpacked with {@link
241   * #unpackRGB(int, RGBChannel)} to retrieve the values. This is helpful for avoiding memory
242   * allocations of new {@code Color} objects and its resulting garbage collector pressure.
243   *
244   * @param r the value of the first channel to pack
245   * @param g the value of the second channel to pack
246   * @param b the value of the third channel to pack
247   * @return the packed integer
248   */
249  public static int packRGB(int r, int g, int b) {
250    return (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
251  }
252
253  /**
254   * Unpacks a single color channel from a packed 32-bit RGB integer.
255   *
256   * <p>Note: Packed RGB colors are expected to be in byte order [empty][red][green][blue].
257   *
258   * @param packedColor the packed color to extract from
259   * @param channel the color channel to unpack
260   * @return the value of the stored color channel
261   */
262  public static int unpackRGB(int packedColor, RGBChannel channel) {
263    return switch (channel) {
264      case kRed -> (packedColor >> 16) & 0xFF;
265      case kGreen -> (packedColor >> 8) & 0xFF;
266      case kBlue -> packedColor & 0xFF;
267    };
268  }
269
270  /**
271   * Performs a linear interpolation between two colors in the RGB colorspace.
272   *
273   * @param a the first color to interpolate from
274   * @param b the second color to interpolate from
275   * @param t the interpolation scale in [0, 1]
276   * @return the interpolated color
277   */
278  public static Color lerpRGB(Color a, Color b, double t) {
279    int packedRGB = lerpRGB(a.red, a.green, a.blue, b.red, b.green, b.blue, t);
280
281    return new Color(
282        unpackRGB(packedRGB, RGBChannel.kRed),
283        unpackRGB(packedRGB, RGBChannel.kGreen),
284        unpackRGB(packedRGB, RGBChannel.kBlue));
285  }
286
287  /**
288   * Linearly interpolates between two RGB colors represented by the (r1, g1, b1) and (r2, g2, b2)
289   * triplets. For memory performance reasons, the output color is returned packed into a single
290   * 32-bit integer; use {@link #unpackRGB(int, RGBChannel)} to extract the values for the
291   * individual red, green, and blue channels.
292   *
293   * @param r1 the red value of the first color, in [0, 1]
294   * @param g1 the green value of the first color, in [0, 1]
295   * @param b1 the blue value of the first color, in [0, 1]
296   * @param r2 the red value of the second color, in [0, 1]
297   * @param g2 the green value of the second color, in [0, 1]
298   * @param b2 the blue value of the second color, in [0, 1]
299   * @param t the interpolation value, in [0, 1]
300   * @return the interpolated color, packed in a 32-bit integer
301   */
302  public static int lerpRGB(
303      double r1, double g1, double b1, double r2, double g2, double b2, double t) {
304    return lerpRGB(
305        (int) (r1 * 255),
306        (int) (g1 * 255),
307        (int) (b1 * 255),
308        (int) (r2 * 255),
309        (int) (g2 * 255),
310        (int) (b2 * 255),
311        t);
312  }
313
314  /**
315   * Linearly interpolates between two RGB colors represented by the (r1, g1, b1) and (r2, g2, b2)
316   * triplets. For memory performance reasons, the output color is returned packed into a single
317   * 32-bit integer; use {@link #unpackRGB(int, RGBChannel)} to extract the values for the
318   * individual red, green, and blue channels.
319   *
320   * @param r1 the red value of the first color, in [0, 255]
321   * @param g1 the green value of the first color, in [0, 255]
322   * @param b1 the blue value of the first color, in [0, 255]
323   * @param r2 the red value of the second color, in [0, 255]
324   * @param g2 the green value of the second color, in [0, 255]
325   * @param b2 the blue value of the second color, in [0, 255]
326   * @param t the interpolation value, in [0, 1]
327   * @return the interpolated color, packed in a 32-bit integer
328   */
329  public static int lerpRGB(int r1, int g1, int b1, int r2, int g2, int b2, double t) {
330    return packRGB(
331        (int) MathUtil.interpolate(r1, r2, t),
332        (int) MathUtil.interpolate(g1, g2, t),
333        (int) MathUtil.interpolate(b1, b2, t));
334  }
335
336  /*
337   * FIRST Colors
338   */
339
340  /** 0x1560BD. */
341  public static final Color kDenim = new Color(0.0823529412, 0.376470589, 0.7411764706, "kDenim");
342
343  /** 0x0066B3. */
344  public static final Color kFirstBlue = new Color(0.0, 0.4, 0.7019607844, "kFirstBlue");
345
346  /** 0xED1C24. */
347  public static final Color kFirstRed =
348      new Color(0.9294117648, 0.1098039216, 0.1411764706, "kFirstRed");
349
350  /*
351   * Standard Colors
352   */
353
354  /** 0xF0F8FF. */
355  public static final Color kAliceBlue = new Color(0.9411765f, 0.972549f, 1.0f, "kAliceBlue");
356
357  /** 0xFAEBD7. */
358  public static final Color kAntiqueWhite =
359      new Color(0.98039216f, 0.92156863f, 0.84313726f, "kAntiqueWhite");
360
361  /** 0x00FFFF. */
362  public static final Color kAqua = new Color(0.0f, 1.0f, 1.0f, "kAqua");
363
364  /** 0x7FFFD4. */
365  public static final Color kAquamarine = new Color(0.49803922f, 1.0f, 0.83137256f, "kAquamarine");
366
367  /** 0xF0FFFF. */
368  public static final Color kAzure = new Color(0.9411765f, 1.0f, 1.0f, "kAzure");
369
370  /** 0xF5F5DC. */
371  public static final Color kBeige = new Color(0.9607843f, 0.9607843f, 0.8627451f, "kBeige");
372
373  /** 0xFFE4C4. */
374  public static final Color kBisque = new Color(1.0f, 0.89411765f, 0.76862746f, "kBisque");
375
376  /** 0x000000. */
377  public static final Color kBlack = new Color(0.0f, 0.0f, 0.0f, "kBlack");
378
379  /** 0xFFEBCD. */
380  public static final Color kBlanchedAlmond =
381      new Color(1.0f, 0.92156863f, 0.8039216f, "kBlanchedAlmond");
382
383  /** 0x0000FF. */
384  public static final Color kBlue = new Color(0.0f, 0.0f, 1.0f, "kBlue");
385
386  /** 0x8A2BE2. */
387  public static final Color kBlueViolet =
388      new Color(0.5411765f, 0.16862746f, 0.8862745f, "kBlueViolet");
389
390  /** 0xA52A2A. */
391  public static final Color kBrown = new Color(0.64705884f, 0.16470589f, 0.16470589f, "kBrown");
392
393  /** 0xDEB887. */
394  public static final Color kBurlywood =
395      new Color(0.87058824f, 0.72156864f, 0.5294118f, "kBurlywood");
396
397  /** 0x5F9EA0. */
398  public static final Color kCadetBlue =
399      new Color(0.37254903f, 0.61960787f, 0.627451f, "kCadetBlue");
400
401  /** 0x7FFF00. */
402  public static final Color kChartreuse = new Color(0.49803922f, 1.0f, 0.0f, "kChartreuse");
403
404  /** 0xD2691E. */
405  public static final Color kChocolate =
406      new Color(0.8235294f, 0.4117647f, 0.11764706f, "kChocolate");
407
408  /** 0xFF7F50. */
409  public static final Color kCoral = new Color(1.0f, 0.49803922f, 0.3137255f, "kCoral");
410
411  /** 0x6495ED. */
412  public static final Color kCornflowerBlue =
413      new Color(0.39215687f, 0.58431375f, 0.92941177f, "kCornflowerBlue");
414
415  /** 0xFFF8DC. */
416  public static final Color kCornsilk = new Color(1.0f, 0.972549f, 0.8627451f, "kCornsilk");
417
418  /** 0xDC143C. */
419  public static final Color kCrimson = new Color(0.8627451f, 0.078431375f, 0.23529412f, "kCrimson");
420
421  /** 0x00FFFF. */
422  public static final Color kCyan = new Color(0.0f, 1.0f, 1.0f, "kCyan");
423
424  /** 0x00008B. */
425  public static final Color kDarkBlue = new Color(0.0f, 0.0f, 0.54509807f, "kDarkBlue");
426
427  /** 0x008B8B. */
428  public static final Color kDarkCyan = new Color(0.0f, 0.54509807f, 0.54509807f, "kDarkCyan");
429
430  /** 0xB8860B. */
431  public static final Color kDarkGoldenrod =
432      new Color(0.72156864f, 0.5254902f, 0.043137256f, "kDarkGoldenrod");
433
434  /** 0xA9A9A9. */
435  public static final Color kDarkGray = new Color(0.6627451f, 0.6627451f, 0.6627451f, "kDarkGray");
436
437  /** 0x006400. */
438  public static final Color kDarkGreen = new Color(0.0f, 0.39215687f, 0.0f, "kDarkGreen");
439
440  /** 0xBDB76B. */
441  public static final Color kDarkKhaki =
442      new Color(0.7411765f, 0.7176471f, 0.41960785f, "kDarkKhaki");
443
444  /** 0x8B008B. */
445  public static final Color kDarkMagenta =
446      new Color(0.54509807f, 0.0f, 0.54509807f, "kDarkMagenta");
447
448  /** 0x556B2F. */
449  public static final Color kDarkOliveGreen =
450      new Color(0.33333334f, 0.41960785f, 0.18431373f, "kDarkOliveGreen");
451
452  /** 0xFF8C00. */
453  public static final Color kDarkOrange = new Color(1.0f, 0.54901963f, 0.0f, "kDarkOrange");
454
455  /** 0x9932CC. */
456  public static final Color kDarkOrchid = new Color(0.6f, 0.19607843f, 0.8f, "kDarkOrchid");
457
458  /** 0x8B0000. */
459  public static final Color kDarkRed = new Color(0.54509807f, 0.0f, 0.0f, "kDarkRed");
460
461  /** 0xE9967A. */
462  public static final Color kDarkSalmon =
463      new Color(0.9137255f, 0.5882353f, 0.47843137f, "kDarkSalmon");
464
465  /** 0x8FBC8F. */
466  public static final Color kDarkSeaGreen =
467      new Color(0.56078434f, 0.7372549f, 0.56078434f, "kDarkSeaGreen");
468
469  /** 0x483D8B. */
470  public static final Color kDarkSlateBlue =
471      new Color(0.28235295f, 0.23921569f, 0.54509807f, "kDarkSlateBlue");
472
473  /** 0x2F4F4F. */
474  public static final Color kDarkSlateGray =
475      new Color(0.18431373f, 0.30980393f, 0.30980393f, "kDarkSlateGray");
476
477  /** 0x00CED1. */
478  public static final Color kDarkTurquoise =
479      new Color(0.0f, 0.80784315f, 0.81960785f, "kDarkTurquoise");
480
481  /** 0x9400D3. */
482  public static final Color kDarkViolet = new Color(0.5803922f, 0.0f, 0.827451f, "kDarkViolet");
483
484  /** 0xFF1493. */
485  public static final Color kDeepPink = new Color(1.0f, 0.078431375f, 0.5764706f, "kDeepPink");
486
487  /** 0x00BFFF. */
488  public static final Color kDeepSkyBlue = new Color(0.0f, 0.7490196f, 1.0f, "kDeepSkyBlue");
489
490  /** 0x696969. */
491  public static final Color kDimGray = new Color(0.4117647f, 0.4117647f, 0.4117647f, "kDimGray");
492
493  /** 0x1E90FF. */
494  public static final Color kDodgerBlue = new Color(0.11764706f, 0.5647059f, 1.0f, "kDodgerBlue");
495
496  /** 0xB22222. */
497  public static final Color kFirebrick =
498      new Color(0.69803923f, 0.13333334f, 0.13333334f, "kFirebrick");
499
500  /** 0xFFFAF0. */
501  public static final Color kFloralWhite = new Color(1.0f, 0.98039216f, 0.9411765f, "kFloralWhite");
502
503  /** 0x228B22. */
504  public static final Color kForestGreen =
505      new Color(0.13333334f, 0.54509807f, 0.13333334f, "kForestGreen");
506
507  /** 0xFF00FF. */
508  public static final Color kFuchsia = new Color(1.0f, 0.0f, 1.0f, "kFuchsia");
509
510  /** 0xDCDCDC. */
511  public static final Color kGainsboro =
512      new Color(0.8627451f, 0.8627451f, 0.8627451f, "kGainsboro");
513
514  /** 0xF8F8FF. */
515  public static final Color kGhostWhite = new Color(0.972549f, 0.972549f, 1.0f, "kGhostWhite");
516
517  /** 0xFFD700. */
518  public static final Color kGold = new Color(1.0f, 0.84313726f, 0.0f, "kGold");
519
520  /** 0xDAA520. */
521  public static final Color kGoldenrod =
522      new Color(0.85490197f, 0.64705884f, 0.1254902f, "kGoldenrod");
523
524  /** 0x808080. */
525  public static final Color kGray = new Color(0.5019608f, 0.5019608f, 0.5019608f, "kGray");
526
527  /** 0x008000. */
528  public static final Color kGreen = new Color(0.0f, 0.5019608f, 0.0f, "kGreen");
529
530  /** 0xADFF2F. */
531  public static final Color kGreenYellow = new Color(0.6784314f, 1.0f, 0.18431373f, "kGreenYellow");
532
533  /** 0xF0FFF0. */
534  public static final Color kHoneydew = new Color(0.9411765f, 1.0f, 0.9411765f, "kHoneydew");
535
536  /** 0xFF69B4. */
537  public static final Color kHotPink = new Color(1.0f, 0.4117647f, 0.7058824f, "kHotPink");
538
539  /** 0xCD5C5C. */
540  public static final Color kIndianRed =
541      new Color(0.8039216f, 0.36078432f, 0.36078432f, "kIndianRed");
542
543  /** 0x4B0082. */
544  public static final Color kIndigo = new Color(0.29411766f, 0.0f, 0.50980395f, "kIndigo");
545
546  /** 0xFFFFF0. */
547  public static final Color kIvory = new Color(1.0f, 1.0f, 0.9411765f, "kIvory");
548
549  /** 0xF0E68C. */
550  public static final Color kKhaki = new Color(0.9411765f, 0.9019608f, 0.54901963f, "kKhaki");
551
552  /** 0xE6E6FA. */
553  public static final Color kLavender = new Color(0.9019608f, 0.9019608f, 0.98039216f, "kLavender");
554
555  /** 0xFFF0F5. */
556  public static final Color kLavenderBlush =
557      new Color(1.0f, 0.9411765f, 0.9607843f, "kLavenderBlush");
558
559  /** 0x7CFC00. */
560  public static final Color kLawnGreen = new Color(0.4862745f, 0.9882353f, 0.0f, "kLawnGreen");
561
562  /** 0xFFFACD. */
563  public static final Color kLemonChiffon =
564      new Color(1.0f, 0.98039216f, 0.8039216f, "kLemonChiffon");
565
566  /** 0xADD8E6. */
567  public static final Color kLightBlue =
568      new Color(0.6784314f, 0.84705883f, 0.9019608f, "kLightBlue");
569
570  /** 0xF08080. */
571  public static final Color kLightCoral =
572      new Color(0.9411765f, 0.5019608f, 0.5019608f, "kLightCoral");
573
574  /** 0xE0FFFF. */
575  public static final Color kLightCyan = new Color(0.8784314f, 1.0f, 1.0f, "kLightCyan");
576
577  /** 0xFAFAD2. */
578  public static final Color kLightGoldenrodYellow =
579      new Color(0.98039216f, 0.98039216f, 0.8235294f, "kLightGoldenrodYellow");
580
581  /** 0xD3D3D3. */
582  public static final Color kLightGray = new Color(0.827451f, 0.827451f, 0.827451f, "kLightGray");
583
584  /** 0x90EE90. */
585  public static final Color kLightGreen =
586      new Color(0.5647059f, 0.93333334f, 0.5647059f, "kLightGreen");
587
588  /** 0xFFB6C1. */
589  public static final Color kLightPink = new Color(1.0f, 0.7137255f, 0.75686276f, "kLightPink");
590
591  /** 0xFFA07A. */
592  public static final Color kLightSalmon = new Color(1.0f, 0.627451f, 0.47843137f, "kLightSalmon");
593
594  /** 0x20B2AA. */
595  public static final Color kLightSeaGreen =
596      new Color(0.1254902f, 0.69803923f, 0.6666667f, "kLightSeaGreen");
597
598  /** 0x87CEFA. */
599  public static final Color kLightSkyBlue =
600      new Color(0.5294118f, 0.80784315f, 0.98039216f, "kLightSkyBlue");
601
602  /** 0x778899. */
603  public static final Color kLightSlateGray =
604      new Color(0.46666667f, 0.53333336f, 0.6f, "kLightSlateGray");
605
606  /** 0xB0C4DE. */
607  public static final Color kLightSteelBlue =
608      new Color(0.6901961f, 0.76862746f, 0.87058824f, "kLightSteelBlue");
609
610  /** 0xFFFFE0. */
611  public static final Color kLightYellow = new Color(1.0f, 1.0f, 0.8784314f, "kLightYellow");
612
613  /** 0x00FF00. */
614  public static final Color kLime = new Color(0.0f, 1.0f, 0.0f, "kLime");
615
616  /** 0x32CD32. */
617  public static final Color kLimeGreen =
618      new Color(0.19607843f, 0.8039216f, 0.19607843f, "kLimeGreen");
619
620  /** 0xFAF0E6. */
621  public static final Color kLinen = new Color(0.98039216f, 0.9411765f, 0.9019608f, "kLinen");
622
623  /** 0xFF00FF. */
624  public static final Color kMagenta = new Color(1.0f, 0.0f, 1.0f, "kMagenta");
625
626  /** 0x800000. */
627  public static final Color kMaroon = new Color(0.5019608f, 0.0f, 0.0f, "kMaroon");
628
629  /** 0x66CDAA. */
630  public static final Color kMediumAquamarine =
631      new Color(0.4f, 0.8039216f, 0.6666667f, "kMediumAquamarine");
632
633  /** 0x0000CD. */
634  public static final Color kMediumBlue = new Color(0.0f, 0.0f, 0.8039216f, "kMediumBlue");
635
636  /** 0xBA55D3. */
637  public static final Color kMediumOrchid =
638      new Color(0.7294118f, 0.33333334f, 0.827451f, "kMediumOrchid");
639
640  /** 0x9370DB. */
641  public static final Color kMediumPurple =
642      new Color(0.5764706f, 0.4392157f, 0.85882354f, "kMediumPurple");
643
644  /** 0x3CB371. */
645  public static final Color kMediumSeaGreen =
646      new Color(0.23529412f, 0.7019608f, 0.44313726f, "kMediumSeaGreen");
647
648  /** 0x7B68EE. */
649  public static final Color kMediumSlateBlue =
650      new Color(0.48235294f, 0.40784314f, 0.93333334f, "kMediumSlateBlue");
651
652  /** 0x00FA9A. */
653  public static final Color kMediumSpringGreen =
654      new Color(0.0f, 0.98039216f, 0.6039216f, "kMediumSpringGreen");
655
656  /** 0x48D1CC. */
657  public static final Color kMediumTurquoise =
658      new Color(0.28235295f, 0.81960785f, 0.8f, "kMediumTurquoise");
659
660  /** 0xC71585. */
661  public static final Color kMediumVioletRed =
662      new Color(0.78039217f, 0.08235294f, 0.52156866f, "kMediumVioletRed");
663
664  /** 0x191970. */
665  public static final Color kMidnightBlue =
666      new Color(0.09803922f, 0.09803922f, 0.4392157f, "kMidnightBlue");
667
668  /** 0xF5FFFA. */
669  public static final Color kMintcream = new Color(0.9607843f, 1.0f, 0.98039216f, "kMintcream");
670
671  /** 0xFFE4E1. */
672  public static final Color kMistyRose = new Color(1.0f, 0.89411765f, 0.88235295f, "kMistyRose");
673
674  /** 0xFFE4B5. */
675  public static final Color kMoccasin = new Color(1.0f, 0.89411765f, 0.70980394f, "kMoccasin");
676
677  /** 0xFFDEAD. */
678  public static final Color kNavajoWhite = new Color(1.0f, 0.87058824f, 0.6784314f, "kNavajoWhite");
679
680  /** 0x000080. */
681  public static final Color kNavy = new Color(0.0f, 0.0f, 0.5019608f, "kNavy");
682
683  /** 0xFDF5E6. */
684  public static final Color kOldLace = new Color(0.99215686f, 0.9607843f, 0.9019608f, "kOldLace");
685
686  /** 0x808000. */
687  public static final Color kOlive = new Color(0.5019608f, 0.5019608f, 0.0f, "kOlive");
688
689  /** 0x6B8E23. */
690  public static final Color kOliveDrab =
691      new Color(0.41960785f, 0.5568628f, 0.13725491f, "kOliveDrab");
692
693  /** 0xFFA500. */
694  public static final Color kOrange = new Color(1.0f, 0.64705884f, 0.0f, "kOrange");
695
696  /** 0xFF4500. */
697  public static final Color kOrangeRed = new Color(1.0f, 0.27058825f, 0.0f, "kOrangeRed");
698
699  /** 0xDA70D6. */
700  public static final Color kOrchid = new Color(0.85490197f, 0.4392157f, 0.8392157f, "kOrchid");
701
702  /** 0xEEE8AA. */
703  public static final Color kPaleGoldenrod =
704      new Color(0.93333334f, 0.9098039f, 0.6666667f, "kPaleGoldenrod");
705
706  /** 0x98FB98. */
707  public static final Color kPaleGreen =
708      new Color(0.59607846f, 0.9843137f, 0.59607846f, "kPaleGreen");
709
710  /** 0xAFEEEE. */
711  public static final Color kPaleTurquoise =
712      new Color(0.6862745f, 0.93333334f, 0.93333334f, "kPaleTurquoise");
713
714  /** 0xDB7093. */
715  public static final Color kPaleVioletRed =
716      new Color(0.85882354f, 0.4392157f, 0.5764706f, "kPaleVioletRed");
717
718  /** 0xFFEFD5. */
719  public static final Color kPapayaWhip = new Color(1.0f, 0.9372549f, 0.8352941f, "kPapayaWhip");
720
721  /** 0xFFDAB9. */
722  public static final Color kPeachPuff = new Color(1.0f, 0.85490197f, 0.7254902f, "kPeachPuff");
723
724  /** 0xCD853F. */
725  public static final Color kPeru = new Color(0.8039216f, 0.52156866f, 0.24705882f, "kPeru");
726
727  /** 0xFFC0CB. */
728  public static final Color kPink = new Color(1.0f, 0.7529412f, 0.79607844f, "kPink");
729
730  /** 0xDDA0DD. */
731  public static final Color kPlum = new Color(0.8666667f, 0.627451f, 0.8666667f, "kPlum");
732
733  /** 0xB0E0E6. */
734  public static final Color kPowderBlue =
735      new Color(0.6901961f, 0.8784314f, 0.9019608f, "kPowderBlue");
736
737  /** 0x800080. */
738  public static final Color kPurple = new Color(0.5019608f, 0.0f, 0.5019608f, "kPurple");
739
740  /** 0xFF0000. */
741  public static final Color kRed = new Color(1.0f, 0.0f, 0.0f, "kRed");
742
743  /** 0xBC8F8F. */
744  public static final Color kRosyBrown =
745      new Color(0.7372549f, 0.56078434f, 0.56078434f, "kRosyBrown");
746
747  /** 0x4169E1. */
748  public static final Color kRoyalBlue =
749      new Color(0.25490198f, 0.4117647f, 0.88235295f, "kRoyalBlue");
750
751  /** 0x8B4513. */
752  public static final Color kSaddleBrown =
753      new Color(0.54509807f, 0.27058825f, 0.07450981f, "kSaddleBrown");
754
755  /** 0xFA8072. */
756  public static final Color kSalmon = new Color(0.98039216f, 0.5019608f, 0.44705883f, "kSalmon");
757
758  /** 0xF4A460. */
759  public static final Color kSandyBrown =
760      new Color(0.95686275f, 0.6431373f, 0.3764706f, "kSandyBrown");
761
762  /** 0x2E8B57. */
763  public static final Color kSeaGreen =
764      new Color(0.18039216f, 0.54509807f, 0.34117648f, "kSeaGreen");
765
766  /** 0xFFF5EE. */
767  public static final Color kSeashell = new Color(1.0f, 0.9607843f, 0.93333334f, "kSeashell");
768
769  /** 0xA0522D. */
770  public static final Color kSienna = new Color(0.627451f, 0.32156864f, 0.1764706f, "kSienna");
771
772  /** 0xC0C0C0. */
773  public static final Color kSilver = new Color(0.7529412f, 0.7529412f, 0.7529412f, "kSilver");
774
775  /** 0x87CEEB. */
776  public static final Color kSkyBlue = new Color(0.5294118f, 0.80784315f, 0.92156863f, "kSkyBlue");
777
778  /** 0x6A5ACD. */
779  public static final Color kSlateBlue =
780      new Color(0.41568628f, 0.3529412f, 0.8039216f, "kSlateBlue");
781
782  /** 0x708090. */
783  public static final Color kSlateGray =
784      new Color(0.4392157f, 0.5019608f, 0.5647059f, "kSlateGray");
785
786  /** 0xFFFAFA. */
787  public static final Color kSnow = new Color(1.0f, 0.98039216f, 0.98039216f, "kSnow");
788
789  /** 0x00FF7F. */
790  public static final Color kSpringGreen = new Color(0.0f, 1.0f, 0.49803922f, "kSpringGreen");
791
792  /** 0x4682B4. */
793  public static final Color kSteelBlue =
794      new Color(0.27450982f, 0.50980395f, 0.7058824f, "kSteelBlue");
795
796  /** 0xD2B48C. */
797  public static final Color kTan = new Color(0.8235294f, 0.7058824f, 0.54901963f, "kTan");
798
799  /** 0x008080. */
800  public static final Color kTeal = new Color(0.0f, 0.5019608f, 0.5019608f, "kTeal");
801
802  /** 0xD8BFD8. */
803  public static final Color kThistle = new Color(0.84705883f, 0.7490196f, 0.84705883f, "kThistle");
804
805  /** 0xFF6347. */
806  public static final Color kTomato = new Color(1.0f, 0.3882353f, 0.2784314f, "kTomato");
807
808  /** 0x40E0D0. */
809  public static final Color kTurquoise =
810      new Color(0.2509804f, 0.8784314f, 0.8156863f, "kTurquoise");
811
812  /** 0xEE82EE. */
813  public static final Color kViolet = new Color(0.93333334f, 0.50980395f, 0.93333334f, "kViolet");
814
815  /** 0xF5DEB3. */
816  public static final Color kWheat = new Color(0.9607843f, 0.87058824f, 0.7019608f, "kWheat");
817
818  /** 0xFFFFFF. */
819  public static final Color kWhite = new Color(1.0f, 1.0f, 1.0f, "kWhite");
820
821  /** 0xF5F5F5. */
822  public static final Color kWhiteSmoke =
823      new Color(0.9607843f, 0.9607843f, 0.9607843f, "kWhiteSmoke");
824
825  /** 0xFFFF00. */
826  public static final Color kYellow = new Color(1.0f, 1.0f, 0.0f, "kYellow");
827
828  /** 0x9ACD32. */
829  public static final Color kYellowGreen =
830      new Color(0.6039216f, 0.8039216f, 0.19607843f, "kYellowGreen");
831}