import { css2rgba } from '@thematic/color' ; import { Theme , Transformer } from '../types' ; param theme export const gimp = ( theme ) => { const headers = [ 'GIMP Palette' , `Name: ${ theme . name } - ${ theme . variant }` , '# This palette is auto-generated by thematic, and contains all of the core color mappings' , ] ; const lines = Object . entries ( theme . scheme ) . reduce ( ( acc , cur ) => { const [ key , value ] = cur ; if ( Array . isArray ( value ) ) { value . forEach ( ( val , idx ) => { const { r , g , b } = css2rgba ( val ) ; acc . push ( `${ r } ${ g } ${ b }\t${ val } ${ key }[${ idx }]` ) ; } ) ; } else { const { r , g , b } = css2rgba ( value ) ; acc . push ( `${ r } ${ g } ${ b }\t${ value } ${ key }` ) ; } return acc ; } , [ ] ) ; return [ ... headers , ... lines ] . join ( '\n' ) ; } ;