color
colorMix
Builds a color-mix(...) value string for any color-accepting property.
import { colorMix } from "@sdxc/u/color";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent") | "color-mix(in oklab, currentcolor 70%, transparent)" |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent"))Signature
u.colorMix(colorSpace: string, ...stops: ColorMixStop[])