import { memoize } from 'lodash' ; param color param defaultColor export const getColor = ( color , defaultColor ? ) : string | undefined => { if ( typeof color !== 'number' || color === - 1 ) return defaultColor ; return `rgb(${ ( color >> 16 ) & 0xff },${ ( color >> 8 ) & 0xff },${ color & 0xff })` ; } ; param color export const getColorNum = memoize ( ( color ? ) : number | undefined => { if ( color ) { const [ r , g , b ] = color . replace ( /([^0-9,])/g , '' ) . split ( ',' ) . map ( ( s ) => parseInt ( s , 10 ) ) ; return ( r << 16 ) + ( g << 8 ) + b ; } return undefined ; } ) ;