ruhley / angular-color-picker

Vanilla AngularJS Color Picker Directive with no requirement on jQuery
http://ruhley.github.io/angular-color-picker/
MIT License
166 stars 79 forks source link

Direct access to individual colour values #137

Closed ashthespy closed 7 years ago

ashthespy commented 7 years ago

Would it be possible to directly get individual r,g,b or hue,saturation,lightness values? I currently re-parsing the $scope.color$ but am wondering what the right way to achieve this would be

EDIT: Please don't bother, forked and added a rawHsl format option and passed the tinycolor.toHsl() object directly. PS: quick hacky work - a0d5d3776b2cc4b552884ecfe1d8004fd6a33182

ruhley commented 7 years ago

@ashthespy I will add a raw format option which will pass back the tinycolor object which you can do as you please

ashthespy commented 7 years ago

Consider this under the label 'Help Wanted' I would like to adjust the lightness via an external slider while maintaining a two way binding between the slider and the actual color object.

Currently, I have setup two watches (one for the slider, one for the color object) to update each other. However, this leads to recursive updating. Any suggestions be to avoid the recursive updates? Plunker

ruhley commented 7 years ago

This is one of the big reasons I generally try to avoid using $watch. See my Plunker using onChange events for both the slider and the color picker.

Side Note: There must be a bug in the color picker that requires the use of $scope.$applyAsync() in this plunker. I have created another ticket to investigate this.

ruhley commented 7 years ago

I have released the raw format option in v3.0.0