toHex method

String toHex()

Implementation

String toHex() {
  final rHex =
      (r * 255).round().toRadixString(16).padLeft(2, '0').toUpperCase();
  final gHex =
      (g * 255).round().toRadixString(16).padLeft(2, '0').toUpperCase();
  final bHex =
      (b * 255).round().toRadixString(16).padLeft(2, '0').toUpperCase();

  return '#$rHex$gHex$bHex';
}