def color.head
gralha-svg-render@0.1.0.1 · svg.bend:830
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-css-style@0.1.0.1/css.bend as CSS
import gralha-image@0.1.0.1/image.bend as Img
830def color.head(+s: String) -> Img.Color:
831 match s:
832 case SNil{}: color.parse("")
833 case SCon{Chr{c}, t}:
834 +ch = c
835 +rest = t
836 U.branch(Img.Color, U32.is_eq(ch, 35), _ => color.hex.fast(color.hex.start(rest), s),
837 _ => color.parse(CSS.css.lower(U.trim.both(s))))