-
Notifications
You must be signed in to change notification settings - Fork 1
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 is the range for the quantize interger and how does it relate to the pallette that is produced? #3
Comments
@michaelzero00 - Sorry for the delay on this (just now seeing it). The quantize value should really be a float between 0 and 255 I think. Here is a function for getting the value:
For example: "web safe" colors have
"web smart" colors have
I should update the documentation on how to use this. I also think I could've had a better API (and better variable names) for this. |
OK, that makes sense! Thanks for taking the time to reply.
…On Wed, 5 May 2021 at 19:53, ◬ ***@***.***> wrote:
I'm not sure how changing the quantize integer will affect the resulting
colour pallette that is used?
@michaelzero00 <https://github.com/michaelzero00> - Sorry for the delay
on this (just now seeing it).
The quantize value should really be a float between 0 and 255 I think.
Here is a function for getting the value:
const getQuantizationValue = (numColors) => numColors > 1 ? 255 / (numColors - 1) : 255;
For example:
"web safe" colors have 6 possible values for each R/G/B value, so calling
getQuantizationValue(6) gives us a quantization value of 51.
- decimal: 0, 51, 102, 153, 204, 255 (each value is incremented by 51)
- hex: 00, 33, 66, 99, CC, FF
"web smart" colors have 16 possible values for each R/G/B value, so
calling getQuantizationValue(16) gives us a quantization value of 17.
- decimal: 0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204,
221, 238, 255 (each value is incremented by 17)
- hex: 00, 11, 22, 33, 44, 55, 66, 77, 88, 99, AA, BB, CC, DD, EE, FF
I should update the documentation on how to use this. I also think I
could've had a better API for this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHM7YJDENPO2VSYCV55FACLTMGH33ANCNFSM43XGIOWA>
.
|
uggh. it looks like i throw an error for non integers for some reason: color-quantize/lib/color-quantize.js Lines 30 to 32 in e78a33c
but i think but i think if you think of it as a "step" value or something it makes more sense. so a value between 1-255. i might try to do testing and see if floats work. if they do i can publish a new version |
I'm not sure how changing the quantize integer will affect the resulting colour pallette that is used?
The text was updated successfully, but these errors were encountered: