def color.space
gralha-svg-render@0.1.0.1 · svg.bend:2243
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
2243def color.space(+c: Img.Color, linear: Bool) -> Img.Color:
2244 Img.Color{r, g, b, a} = c
2245 U.branch(Img.Color, linear,
2246 _ => Img.Color{(srgb.linear((r / U.max(a, 0.0000001) : F32)) * a : F32),
2247 (srgb.linear((g / U.max(a, 0.0000001) : F32)) * a : F32),
2248 (srgb.linear((b / U.max(a, 0.0000001) : F32)) * a : F32), a}, _ => c)