WickyNilliams / react-simple-colorpicker

Simple, composable, lightweight colorpicker for react
http://wicky.nillia.ms/react-simple-colorpicker
MIT License
45 stars 19 forks source link

Consider allowing value={pure-color value} and onChange calls back with pure-color value #10

Open BradHarris opened 8 years ago

BradHarris commented 8 years ago

It would be nice if your color picker used your pure-color value format as a value for input and output instead of rgba string. This would cut down on parsing and converting inside the color picker and would allow users to use your pure-color lib to manage formats how they need to outside of the color picker.

I realize this would break the current API but tis only a suggestion.

WickyNilliams commented 8 years ago

You mean an array like [r, g, b, a]?

I've considered this a few times. I may even have a branch locally where I've done this. Though I can't remember why I never settled on it? I'll think about it again :)

Are you having perf issues, or is this just an idea?

BradHarris commented 8 years ago

Just an idea, there are no performance issues but currently the data is going through this transformation: data -> convert to rgbastring -> color-picker -> parse to pure-color -> change happens -> convert to rgbastring -> calback with rgbastring -> parse rgbastring -> convert to data

it could be data -> convert to pure-color -> color-picker -> change happens -> -> calback with pure-color -> convert to data