You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly this is a brilliant little tool, and were implementing it where i work (I added a few little events a while ago to help with throttling an associated chart).
Anyhow were in a situation where its possible the picker could be passed a non RGB or HEX value such as red or blue. We would need this to be detected and converted into the selected colour format so the picker will continue to function.
Ive had another look through the code base and found a potential solution. The colour could be checked in the ngModel watch. A regex could be used to check if its not RGB or HEX and if so run it through a converter, then continue.
I am a little concerned with window.getComputedStyle, its support is IE9+. My other concern with that implementation is the adding and removing of DOM elements. It could be possible to have a hidden element that persists for this use so we don't have to create and remove it speeding the process up.
Lastly this will convert it to a RGB string so finally if HEX or RGBA is selected we will have to convert it again to that format.
Would this be an extra feature that could be included? I don't mind it being an opt-in feature with the use of a data-attribute etc. If it is something then i can have a pull request ready by tomorrow.
Again thanks!
The text was updated successfully, but these errors were encountered:
Firstly this is a brilliant little tool, and were implementing it where i work (I added a few little events a while ago to help with throttling an associated chart).
Anyhow were in a situation where its possible the picker could be passed a non
RGB
orHEX
value such asred
orblue
. We would need this to be detected and converted into the selected colour format so the picker will continue to function.Ive had another look through the code base and found a potential solution. The colour could be checked in the
ngModel
watch. A regex could be used to check if its not RGB or HEX and if so run it through a converter, then continue.The psuedo code below should do the trick.
I am a little concerned with
window.getComputedStyle
, its support is IE9+. My other concern with that implementation is the adding and removing of DOM elements. It could be possible to have a hidden element that persists for this use so we don't have to create and remove it speeding the process up.Lastly this will convert it to a RGB string so finally if HEX or RGBA is selected we will have to convert it again to that format.
Would this be an extra feature that could be included? I don't mind it being an opt-in feature with the use of a data-attribute etc. If it is something then i can have a pull request ready by tomorrow.
Again thanks!
The text was updated successfully, but these errors were encountered: