PdfColorHsv constructor
Creates an HSV color
Implementation
factory PdfColorHsv(double hue, double saturation, double value,
[double alpha = 1.0]) {
final chroma = saturation * value;
final secondary = chroma * (1.0 - (((hue / 60.0) % 2.0) - 1.0).abs());
final match = value - chroma;
double red;
double green;
double blue;
if (hue < 60.0) {
red = chroma;
green = secondary;
blue = 0.0;
} else if (hue < 120.0) {
red = secondary;
green = chroma;
blue = 0.0;
} else if (hue < 180.0) {
red = 0.0;
green = chroma;
blue = secondary;
} else if (hue < 240.0) {
red = 0.0;
green = secondary;
blue = chroma;
} else if (hue < 300.0) {
red = secondary;
green = 0.0;
blue = chroma;
} else {
red = chroma;
green = 0.0;
blue = secondary;
}
return PdfColorHsv._(hue, saturation, value, (red + match).clamp(0.0, 1.0),
(green + match).clamp(0.0, 1.0), (blue + match).clamp(0.0, 1.0), alpha);
}