contrastColor static method
Calculates the limunance for the given hex
color and returns black as hex for bright colors, white as hex for dark colors.
Implementation
static String contrastColor(String hex) {
var bC = basicColorsFromHex(hex);
var luminance = calculateRelativeLuminance(
bC[BASIC_COLOR_RED]!, bC[BASIC_COLOR_GREEN]!, bC[BASIC_COLOR_BLUE]!);
return luminance > 0.5 ? HEX_BLACK : HEX_WHITE;
}