PdfColorHsv.fromRgb constructor

PdfColorHsv.fromRgb(
  1. double red,
  2. double green,
  3. double blue, [
  4. double alpha = 1.0,
])

Creates an HSV color from red, green, blue components

Implementation

factory PdfColorHsv.fromRgb(double red, double green, double blue,
    [double alpha = 1.0]) {
  final max = math.max(red, math.max(green, blue));
  final min = math.min(red, math.min(green, blue));
  final delta = max - min;

  final hue = _getHue(red, green, blue, max, delta);
  final saturation = max == 0.0 ? 0.0 : delta / max;

  return PdfColorHsv._(hue, saturation, max, red, green, blue, alpha);
}