materialNameAndCode static method
Returns the official Material color name for the color passed to it, including the shade index and Flutter style HexCode.
If it is not a Material color or one of the Accents colors, only the Flutter style Hex code is returned.
Implementation
static String materialNameAndCode(Color color,
{Map<ColorSwatch<Object>, String>? colorSwatchNameMap}) {
final String name =
materialName(color, colorSwatchNameMap: colorSwatchNameMap);
if (name == '') {
// This is not a material color, we just return it's Flutter like HEX code
return '(0x${colorCode(color)})';
} else {
return '$name (0x${colorCode(color)})';
}
}