intentBgExpr
Commons
stable
Builds the CSS color-mix() expression for the background of an intent token at a given interaction role (default, hover, active, disabled). Falls back gracefully when the token is absent by mixing the base bg with black.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- intentrequiredTIntent
- The semantic intent: primary, secondary, ghost, neutral, success, warning, danger, or info.
- rolerequiredTBgFgRole
- The interaction state: default, hover, active, or disabled. Hover and active darken the base bg via color-mix() when the explicit token is absent.
API
Return value
The value returned by this util.
- A CSS var() or color-mix() expression string ready to assign to background-color.
Usage
Examples
Ready-to-paste usage snippets.
Generate intent background expressions