gka / chroma.js

JavaScript library for all kinds of color manipulations
https://gka.github.io/chroma.js/
Other
10.08k stars 543 forks source link

Chroma not able to parse a value that passed through it #273

Open whizzbbig opened 3 years ago

whizzbbig commented 3 years ago

function colorizeSliders(color, hue, brightness, saturation) { // Scale Brightness const midBright = color.set("hsl.l", 0.5); // isn't responding Screenshot 2564-06-26 at 2 49 09 AM

https://user-images.githubusercontent.com/54703305/123492661-c3b69400-d637-11eb-9979-7d7d1156a604.mov

const scaleBright = chroma.scale("black", midBright, "white");

// Scale Saturation const noSat = color.set("hsl.s", 0); const fullSat = color.set("hsl.s", 1); const scaleSat = chroma.scale([noSat, color, fullSat]);

// Update Input Colors saturation.style.backgroundImage = linear-gradient(to right, ${scaleSat( 0 )}, ${scaleSat(1)}); brightness.style.backgroundImage = linear-gradient(to right, ${scaleBright( 0 )}, ${scaleBright(1)}); hue.style.backgroundImage = linear-gradient(to right, rgb(204, 75, 75), rgb(204, 204, 74), rgb(75, 204, 75), rgb(75, 204, 204). rgb(75, 75, 204), rgb(204, 75, 204), rgb(204, 75, 75)}); }

whizzbbig commented 3 years ago

the main issue is whenever i try to update input for hue and brightness it shows errror that i dont get

korompaiistvan commented 3 years ago

I think you might be missing a set of square brackets around the inputs on line 52.

whizzbbig commented 3 years ago

I think you might be missing a set of square brackets around the inputs on line 52.

uh actually i was following the course of dev ed and i am pretty sure that i haven't missed anything

korompaiistvan commented 3 years ago

i don't know who dev ed is.

compare how you're calling the function on line 52 vs 57. on 52 you're passing the bare arguments, on 57 you pass them as an array. both can't be right (and the documentation shows the array option is expected)

On Sun, 25 Jul 2021, 23:10 whizzbbig, @.***> wrote:

I think you might be missing a set of square brackets around the inputs on line 52.

uh actually i was following the course of dev ed and i am pretty sure that i haven't missed anything

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gka/chroma.js/issues/273#issuecomment-886258128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISWZSYMIGGVUVS4LPW4O3LTZR4VLANCNFSM47KWF23A .

whizzbbig commented 3 years ago

sir help me to correct it then..