rgbToHex static method
RGB values are ranging in 0;1
.
@param tuple An array containing the color's RGB values.
@return A string containing a #RRGGBB
representation of given color.
Implementation
static String rgbToHex(List<double> tuple) {
String h = "#";
for (int i = 0; i < 3; i += 1) {
double chan = tuple[i];
var c = (chan * 255).round();
var digit2 = c % 16;
var digit1 = ((c - digit2) ~/ 16);
h += hexChars[digit1] + hexChars[digit2];
}
return h;
}