PitPik / colorPicker

Advanced javaScript color picker and color conversion / calculation (rgb, hsv, hsl, hex, cmyk, cmy, XYZ, Lab, alpha, WCAG 2.0, ...)
http://www.dematte.at/colorPicker/
MIT License
570 stars 136 forks source link

Initial text color of input in javascript implementation #10

Closed Martin1887 closed 9 years ago

Martin1887 commented 9 years ago

When your click in input to show picker, the CSS color of input is changed in function of the luminance of its background-color. However, before click text color is always black instead of being correct color in function of luminance.

Correcting it would be great and low-cost I think.

Thanks and congratulations, the picker is really good!

PitPik commented 9 years ago

@Martin1887 The intention in the implementation was to initialize colorPicker as late as possible, so only when it's needed and the end-user clicks inside the input field. Therefore there is no values available about color contrast and luminance... I made a workaround by initializing an instance of Colors (which is lighter and I take one for all the colorPickers) and passing the resulting color values to the init callback. This way you can get all information you need. Be aware though that this instance is never connected to ColorPicker at any time. It only gives color values at init time. BTW: If you like this tool, please don't miss the ★ button ;o) I will commit the new code this afternoon or maybe tomorrow... Thanks for your productive feedback!

PitPik commented 9 years ago

@Martin1887 It's done!! Thanks for the ★ ;o)