Now colors work with lighter colors

This commit is contained in:
Bel Curcio 2021-03-02 11:20:24 -03:00
parent 4a64c02c8d
commit c87d02a7cd

View File

@ -194,6 +194,7 @@ const colorMap: Record<string, string> = {
}
export function isDark(color: string = ''): boolean {
color = color.toLowerCase()
// Equation from http://24ways.org/2010/calculating-color-contrast
let rgb = colorMap[color] ? hexToRgb(colorMap[color]) : hexToRgb(color)
const res = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000