Closed codergigachad closed 3 years ago
Hi! Seems like your case is pretty specific (I don't know any color manipulation library that supports this kind of behavior). I also don't understand how the library should process conflicting colors like
colord({ r: 0, g: 0, b: 0, hex: "#ffffff" })
I would recommend you to pass the values of the last edited fields.
For example, if a user just edited B
field, pass to Colord values of R
, G
and B
inputs (rgb object). If the user just edited the hex field, call colord(hexInput.value)
I am using it with react-colorful and I wanted to make multiple color inputs using a single state. But react states updates asynchronously that's why I can't get the value of that state in the same function because it updates after the execution of the whole function. Now I am trying class components hope it works thanks for your help!
var color = colord({r: 255, g: 255, b: 255, a: 1, hex: "#ffffff"}) // not supported input
If it's supported please tell me if I am doing something wrong here. I am using colord to make a color picker in react with react-colorful.