import { Token, TokenGroup } from "../../../types/Token"; import { getColors } from '../properties'; import { StylePropertyType } from "../../../types/style/StylePropertyType"; import { StyleBackgroundRule } from "../../../types/style/StyleBackgroundRule"; export function parseBackground( tokens: Token[] ): StyleBackgroundRule | null { const colors = getColors( tokens ); const url = tokens.find( x => x.group === TokenGroup.Custom && x.section === 'string' && x.key.indexOf( 'http' ) !== -1 )?.key; const color = colors.length > 0 ? colors[0] : undefined; return { type: StylePropertyType.Background, color, url } }