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

What determins a luminosity of "Bright" #118

Open
Xliff opened this issue Feb 11, 2019 · 3 comments
Open

What determins a luminosity of "Bright" #118

Xliff opened this issue Feb 11, 2019 · 3 comments
Labels

Comments

@Xliff
Copy link
Contributor

Xliff commented Feb 11, 2019

@davidmerfield -- How are you defining "Bright" colors for RandomColor? I am attempting to write a numerical test for "bright" colors, and am wondering how it is defined in generation. From what I can see, it looks like the minumum saturation should be 55, however I can use this piece of code:

console.log(
  randomColor({
    seed: 2019021101,
    luminosity: 'bright',
    count: 5,
    format: 'hslArray'
  })
);

And the first color I get turns out to be [ 191, 53.43, 54.905 ], which has an S value lower than that. Can you please clarify?

@Xliff
Copy link
Contributor Author

Xliff commented Feb 12, 2019

Just for shiz and grins, I took that sequence out until it looked stable. I generated 100,000 before the S min bottomed out at 37.93.

That seems to be a rather low S for "Bright" though.

@davidmerfield
Copy link
Owner

davidmerfield commented Feb 13, 2019

That is curious, sounds like a bug. luminosity: 'bright' should always produce HSV colours with an S value greater than 55. Thank you for bringing this to my attention. Will investigate more deeply when I get a chance.

@pourya-momtaz
Copy link

@davidmerfield I just checked the whole code and based on this statement “should always produce HSV colours with an S value greater than 55.”, the code works fine and actually there are no bugs in it. I checked “pickSaturation” function and it was perfectly fine (just a simple switch case to determine the range of saturation :) ) and to make sure, I checked the output. Then I checked “setFormat” function and its inputs (using ‘console.log(hsv);’) and again, everything worked round the clock and I concluded that hsv arguments are correct. I think @Xliff has misunderstood something or meant to use ‘hsvArray’ instead of ‘hslArray’ because saturation in hsl is calculated by a different formula. In short, if you want the ‘S’ value of hsl to be more than 55, you have to change the inputs or sMin, but if you want the ‘S’ value of hsv (or hsb) to be more than 55 (based on your last response), your code is perfectly fine :).

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

No branches or pull requests

3 participants