mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +00:00
Now colors work with lighter colors
This commit is contained in:
parent
4a64c02c8d
commit
c87d02a7cd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user