toHex method

  1. @override
String toHex()

Implementation

@override
String toHex() {
  double _c = c / 100;
  double _m = m / 100;
  double _y = y / 100;
  double _k = k / 100;
  Function toHex = (double x) {
    var hex = (x * 255).round().toRadixString(16);
    return hex.length == 1 ? '0' + hex : hex;
  };
  return "#" +
      toHex((1 - _c) * (1 - _k)) +
      toHex((1 - _m) * (1 - _k)) +
      toHex((1 - _y) * (1 - _k));
}