Color toColor()

Returns this color in RGB.

Source

Color toColor() {
  final double h = hue % 360;
  final double c = saturation * value;
  final double x = c * (1 - (((h / 60.0) % 2) - 1).abs());
  final double m = value - c;

  double r;
  double g;
  double b;
  if (h < 60.0) {
    r = c;
    g = x;
    b = 0.0;
  } else if (h < 120.0) {
    r = x;
    g = c;
    b = 0.0;
  } else if (h < 180.0) {
    r = 0.0;
    g = c;
    b = x;
  } else if (h < 240.0) {
    r = 0.0;
    g = x;
    b = c;
  } else if (h < 300.0) {
    r = x;
    g = 0.0;
    b = c;
  } else {
    r = c;
    g = 0.0;
    b = x;
  }
  return new Color.fromARGB(
    (alpha   * 0xFF).round(),
    ((r + m) * 0xFF).round(),
    ((g + m) * 0xFF).round(),
    ((b + m) * 0xFF).round()
  );
}