import { transSketchColor } from '../../common/utils' ; import { SKLayer , SKColor , TextStyle , SKFillItem } from '../../types' ; import handleSolidColorFill from '../parseStyle/parseFill/handleSolidColorFill' ; export default ( color , layer ) : TextStyle => { let fillList = [ ] ; if ( layer . style && Array . isArray ( layer . style . fills ) ) { fillList = layer . style . fills . filter ( fillItem => { return fillItem . isEnabled ; } ) ; } if ( fillList . length > 0 ) { const fillStyle = fillList [ fillList . length - 1 ] ; const fillType = fillStyle . fillType ; if ( fillType === 0 ) { return handleSolidColorFill ( fillStyle , layer ) ; } } let alpha = color . alpha ; if ( layer . style && layer . style . contextSettings ) { alpha = layer . style . contextSettings . opacity * color . alpha ; } return { color : transSketchColor ( { red : color . red , green : color . green , blue : color . blue , alpha } ) , } ; } ;