Skip to content

pantoken-root / plugins/pantoken/colors/src / alpha

Function: alpha() ​

alpha(color, percent): string

Beta

Set a color's opacity to percent% — the CSS-only mirror of ui-color-utils alpha. Mixing with transparent yields exactly the color at that alpha channel.

Parameters ​

color ​

string

The base color (literal, var(--token), or a nested helper result).

percent ​

number

The target opacity, 0–100.

Returns ​

string

A color-mix() expression.

Example ​

ts
alpha("var(--brand)", 10); // "color-mix(in srgb, var(--brand) 10%, transparent)"