color-picker
color-picker copied to clipboard
Picker not working with numeric only hex values?
Hi, it seems that if I have a data-color="#276895"
, numeric only hex number, it does not work, and returns black as fallback.
Also, is it ok for the "change" event to fire after init? Thanks.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
You can always override the default color parser to make the #
part becomes optional because this method is static.
https://github.com/taufik-nurrohman/color-picker/blob/v2.2.4/index.mjs#L444-L465
Example:
let originalColorParser = CP.HEX;
CP.HEX = x => {
if ('string' === typeof x && '#' !== x[0]) {
x = '#' + x;
}
return originalColorParser(x);
};
Also, is it OK for the "change" event to fire after init?
Any example?