def color.hex.fast
gralha-svg-render@0.1.0.1 · svg.bend:824
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
824def color.hex.fast(scanned: U32 & U32, s: String) -> Img.Color:
825 (x, n) = scanned
826 +len = n
827 U.branch(Img.Color, U32.is_eq(len, 3) || U32.is_eq(len, 4) || U32.is_eq(len, 6) || U32.is_eq(len, 8),
828 _ => color.hex(x, len), _ => color.parse(CSS.css.lower(U.trim.both(s))))