jodhman / react-eyedrop

Seamlessly integrate a static typed, fully-tested color-picking React component/hook!
24 stars 11 forks source link

EyeDropper getting the wrong color #5

Closed gundamftw closed 5 years ago

gundamftw commented 5 years ago

The plugin in giving me the wrong color, I have body background color set to lightgray and the eyedropper is reading it as rgb(255, 255, 255).

class App extends Component {
    handleChangeColor ({ rgb, hex }) {
        console.log(rgb);
    }
    render() {
        return (
            <div>               
                <EyeDropper
                    onChange={this.handleChangeColor} />
            </div>
        );
    }
}
gundamftw commented 5 years ago

And the radius result is wrong too, I sampled on a "white" part of an image and it is reading it as rgb(164, 159, 140).

<EyeDropper pickRadius={{ unit: 'radius', amount: 1 }}  />

Setting amount to 0 gives a blow up number.

jodhman commented 5 years ago

Uh-oh. Smells like a bug in the dependencies. Will have to change the way pixels are translated into colors.

Setting amount to 0 with unit radius should be handled with an error. That's a bug, right there.

jodhman commented 5 years ago

Setting amount to less than 1 now correctly throws an error. The dependency bug will be handled as soon as a better replacement is found.

jodhman commented 5 years ago

Saw that the canvas-to-color dependency had a major update which contained a bugfix. Updated the dependency and released version 3.3.2 containing the update. Let's see if this resolved the issue.

gundamftw commented 4 years ago

Nope, all the color are still wrong :(