KroneCorylus / ngx-colors

Simple yet elegant Material color picker for Angular
https:\\ngx-colors.web.app
MIT License
88 stars 24 forks source link

Convert value to fixed format on apply value #98

Closed MelanieW97 closed 10 months ago

MelanieW97 commented 1 year ago

Hey,

I set format="hex" on ngx-colors tag. However, if the user types in rgb(255,255,255), it does not convert the value to HEX. That's problematic for me since it still uses the value as a valid color. I just got the wrong format now. The value I get from the picker is "rgb(255,255,255)".

Colors_RGB

It seems to be possible for you to convert the value, though. Once you reopen the picker, it says "#FFFFFF" all of a sudden. You convert the value once the picker gets opened. That's too late.

image

Would it be possible to convert the value on picker close event? Or you could export the convert function so users can use them themselves. It'd be great to get access to this function regardless of how you're going to handle this problem.

Thanks in advance. :)