Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB black can't be added to palette #2

Open
biologeek opened this issue Apr 19, 2019 · 1 comment
Open

RGB black can't be added to palette #2

biologeek opened this issue Apr 19, 2019 · 1 comment

Comments

@biologeek
Copy link

biologeek commented Apr 19, 2019

Hi !

While testing the RGB mode, I created a custom palette containing (among others) black color.

When generating the component, in the verifyPalette(palette) function, verification fails due to these lines :

if (!color.hex && !color.r && !color.g && !color.b) {
                throw Error('Colors must provide at least a hex or rgb value');
}

As color is defined with its R, G and B attributes that are all 0, color.r, color.g, color.b and color.hex are all falsy values.

Could you please check this issue ?
Thanks for your work on this nice component !
Xavier

@biologeek
Copy link
Author

This could solve the issue :

if (!(color.hasOwnProperty('hex')
                || (color.hasOwnProperty('r') && color.hasOwnProperty('b') && color.hasOwnProperty('g'))
                )) {
                throw Error('Colors must provide at least a hex or rgb value');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant