public static class VarSubstitutionSubstitutes var(--name, fallback) against an element's custom properties.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Textual, and correct to be. CSS defines var() as a substitution over the token stream at computed-value time, before the value is parsed as anything in particular — which is exactly why --corner: 4px can be used by border-radius and by padding without either of them knowing about the other. Doing it here, on the text, keeps the property system downstream of it and unaware of it.
ExCSS makes this workable by leaving anything containing a var() verbatim — the [spike](../../docs/plan/spikes/vcss-excss/RESULT.md) checked exactly that. It has a consequence worth stating: color: red reaches Vixen already normalised to rgb(255, 0, 0), but color: var(--accent) with --accent: red reaches it as red. The value parser has to accept both, because the front end normalises only what it could see.
A var() that resolves to nothing and has no fallback makes the declaration invalid at computed-value time, which is not the same as dropping it: the property falls back to its inherited or initial value rather than to the next declaration in the cascade. Returning is how that is said here.
Fields and properties (1)
public const int MaximumDepthHow deep a chain of custom properties referring to each other may go.
Methods (2)
public static bool NeedsSubstitution(string value)Whether a value contains anything to substitute.
public static string? Substitute(string value, Func<string, string?> lookup)Substitutes every var() in a value.
Used by (3)
- ShorthandExpansionVixen.Ui.Styling
- StyleResolverVixen.Ui.Styling
- StyleSheetLoaderVixen.Ui.Styling