ruhley / angular-color-picker

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

Transparency with hex format #55

Closed pixedd closed 8 years ago

pixedd commented 8 years ago

Hello, is there a way to get transparency with hex format ?

Currently I can get that, by using color-picker-format="rgb" and color-picker-alpha="true", however I would like to keep an hex format ?

Thanks !

ruhley commented 8 years ago

Hex does not cater for transparency. However that is what Hex8 was created for.

celluj34 commented 8 years ago

Sorry to necro this thread, but it's very relevant to my interests.

I have a requirement to display a HEX editor with an available transparency/opacity selector. On the back end, I want to convert it to RGBA, but HEX is "more user friendly". Would it be possible to display the selector and provide the opacity value on the onChange event?

ruhley commented 8 years ago

If you want to display hex with opacity then you will need to select hex8. Then in the onChange event you can use tinycolor to convert it to rgba:

var rgb_object = tinycolor('#36A193D2').toRgb();
var rgb_string = tinycolor('#36A193D2').toRgbString();

Tinycolor should already be imported as a dependency of this package.

celluj34 commented 8 years ago

Awesome. Good enough for me! Thanks!

Joseph Cellucci Software Developer ITA Group celluj34@gmail.com

On Wed, Sep 14, 2016 at 10:12 PM, Ruhley notifications@github.com wrote:

If you want to display hex with opacity then you will need to select hex8. Then in the onChange event you can use tinycolor to convert it to rgba:

var rgb_object = tinycolor('#36A193D2').toRgb();var rgb_string = tinycolor('#36A193D2').toRgbString();

Tinycolor should already be imported as a dependency of this package.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ruhley/angular-color-picker/issues/55#issuecomment-247222343, or mute the thread https://github.com/notifications/unsubscribe-auth/AJyd1YrwO9d7mT71tgAWFn9BYFICUmweks5qqLeagaJpZM4HYCRr .