import { IcolorDataFull } from '../ts-interfaces/interfaces' ; import { colorToHsla , getColorData } from './index' ; export const getColorsFromString = ( inputValue ) : IcolorDataFull [ ] => { const colorsList = inputValue . split ( '\n' ) . filter ( item => { return item . trim ( ) . includes ( ':' ) ; } ) ; return colorsList . map ( item => { const str = item . trim ( ) . replace ( ';' , '' ) ; let [ name , color ] = str . split ( ':' ) ; color = color . trim ( ) ; const data = getColorData ( color ) ; const hsla = colorToHsla ( { color , ... data } ) ; return < IcolorDataFull > { colorName : name . trim ( ) , hsla , color , ... data } ; } ) ; } ;