export function toColorHexNum ( color ) { return parseInt ( color . replace ( /^\#/ , '0x' ) ) ; } export function toColorHexStr ( color ) { return '#' + color . toString ( 16 ) ; } export function isColorStr ( color ? ) { return typeof color === 'string' && /^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i . test ( color ) ; }