def color.hex.string

gralha-svg-render@0.1.0.1 · svg.bend:787

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-image@0.1.0.1/image.bend as Img

787def color.hex.string(+s: String) -> Img.Color:
788  +n = length(s)
789  U.branch(Img.Color, (U32.is_eq(n, 3) || U32.is_eq(n, 4) || U32.is_eq(n, 6) || U32.is_eq(n, 8)) && color.hex.valid(s),
790    _ => color.hex(U.hex(s, 0), n), _ => color.rgb(0))

Uses (11)

Used by (1)