Table of Contents

Method ResolveVariables

Namespace
SharpVectors.Renderers.Wpf
Assembly
SharpVectors.Rendering.Wpf.dll

ResolveVariables(string)

Resolves CSS variable references in a property value with support for fallbacks and nested variables.

public static string ResolveVariables(string value)

Parameters

value string

A CSS property value that may contain var() function syntax.

Returns

string

A resolved value, fallback value, or empty string if unresolved.

Remarks

This is the main entry point for CSS variable resolution. It handles:

  • Simple unresolved variables: "var(--missing)" → "" (empty, triggers default)
  • Variables with fallback: "var(--missing, #FF0000)" → "#FF0000"
  • Nested/chained fallbacks: "var(--a, var(--b, #000))" → "#000"
  • Multiple var() in one value: Each is processed independently

Non-variable strings (e.g., "red", "#000", "300") are returned unchanged.