-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When I try to use this lib, I get that error: TypeError: Cannot set property 'namedColors' of undefined
(Regardless of whether I use the class or static method)
I can fix it by changing https://github.com/busterc/contrast-color/blob/main/lib/index.js#L211-L220 to:
function contrastColor({
bgColor = '#FFFFFF',
fgDarkColor = '#000000',
fgLightColor = '#FFFFFF',
defaultColor = '#000000',
threshold = 128,
customNamedColors = {},
} = {}) {
const namedColors = { ...NAMED_COLORS, ...customNamedColors }
const [
namedBgColor,
namedFgDarkColor,
namedFgLightColor,
namedDefaultColor,
] = [bgColor, fgDarkColor, fgLightColor, defaultColor].map(
(p) => namedColors[p],
)(I'm just not calling this inside a function)
BenceSzalai
Metadata
Metadata
Assignees
Labels
No labels