toColor method

Color toColor()

Implementation

Color toColor() {
  double r;
  double g;
  double b;
  final double h = bound01(this.h, 360.0);
  final double s = bound01(this.s * 100, 100.0);
  final double l = bound01(this.l * 100, 100.0);

  if (s == 0.0) {
    r = g = b = l;
  } else {
    final q = l < 0.5 ? l * (1.0 + s) : l + s - l * s;
    final p = 2 * l - q;
    r = _hue2rgb(p, q, h + 1 / 3);
    g = _hue2rgb(p, q, h);
    b = _hue2rgb(p, q, h - 1 / 3);
  }
  return Color.fromARGB(a.round(), (r * 255).round(), (g * 255).round(), (b * 255).round());
}