parsePaint static method

CSSPaint? parsePaint(
  1. String paint, {
  2. required RenderStyle renderStyle,
})

Implementation

static CSSPaint? parsePaint(String paint, { required RenderStyle renderStyle }) {
  if (paint == NONE) {
    return none;
  }
  switch(paint) {
    case NONE: return none;
    case CURRENT_COLOR: return currentColor;
    case CONTEXT_FILL: return contextFill;
    case CONTEXT_STROKE: return contextStroke;
  }

  final color = CSSColor.parseColor(paint, renderStyle: renderStyle);
  if (color != null) {
    return CSSPaint(CSSPaintType.color, color: color);
  }
  return null;
}