hex property

String get hex

Returns the hex value of the color.

Implementation

String get hex {
  final red = (r * 255).toInt().toRadixString(16).padLeft(2, '0');
  final green = (g * 255).toInt().toRadixString(16).padLeft(2, '0');
  final blue = (b * 255).toInt().toRadixString(16).padLeft(2, '0');
  final alpha = (a * 255).toInt().toRadixString(16).padLeft(2, '0');
  return '#$alpha$red$green$blue';
}