createHexStringFromColor function

String createHexStringFromColor(
  1. Color color
)

Returns a string HEX color prefixed with "#".

Implementation

String createHexStringFromColor(Color color) {
  final value =
      (color.value & 0xFFFFFF).toRadixString(16).padLeft(6, '0').toUpperCase();

  return '#$value';
}