casesandberg / react-color

:art: Color Pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
http://casesandberg.github.io/react-color/
MIT License
12.05k stars 922 forks source link

[2.9.13] - SketchPicker - Regression #826

Closed c0ncentus closed 3 years ago

c0ncentus commented 3 years ago

Hi , my base code is

            <SketchPicker color={this.state.value} onChange={(e: any) => {
                console.log(e)
                const hsl = e.hsl;
                const rgb = e.rgb;
                const value = this.state.value;
                let colorValueSend: string = "";
                if (/^#/gm.test(value) || extra!.colorMode! === "Hex") { colorValueSend = e.hex }
                if (/rgb/gm.test(value) || extra!.colorMode! === "Rgb") { colorValueSend = `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})` }
                if (/hsl/gm.test(value) === true || extra!.colorMode! === "Hsl") { colorValueSend = `hsl(${hsl.h}, ${hsl.l * 100}%, ${hsl.s * 100}%)` }
                this.setState({ value: colorValueSend });
                handleValue(false, undefined, colorValueSend)
            }} />

PS: handleValue is custom function on parent*

In the old version i have no issue about that;

image It is really kinda weird so i will explain with picture I expect to click on rgb(255,0,0) but got rgb(255,255,255). and every selection is like that on "random" symetric values ... thats boring

c0ncentus commented 3 years ago

Ok i Understand my value begin to "a" not by rgb/hsl/hex values ... but really don't understand what happen next because if value is well fill by color it should give exact rgb values whatever next .... really weird behavior : /