Skip to content
ChartForgeX
Class

VisualDesignTokens

ChartForgeX.Themes

Namespace
ChartForgeX.Themes
Assembly
ChartForgeX
Modifiers
sealed

Builds product-neutral semantic color palettes. A VisualTheme snapshots these mutable values.

Inheritance

  • object
  • VisualDesignTokens

Usage

Explore 13 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 4

Constructors

public VisualDesignTokens() #

Methods

public VisualDesignTokens Clone() #

Creates an independent copy.

public void CopyFrom(VisualDesignTokens source) #

Replaces this editable palette with an independent copy of another palette.

Parameters

source ChartForgeX.Themes.VisualDesignTokens required
public static VisualDesignTokens Dark() #

Creates a dark token set suitable for reports, dashboards, and wallpapers.

public static VisualDesignTokens FromJson(string json, ThemeMode mode = Light) #

Loads tokens from the generated design-token JSON (the HtmlForgeX design tokens 1.x; 1.1.0 adds the optional ramps). The document holds a light and a dark object, each with surface, text, chrome, accent, severity (fill and ink), outcome, state, and series, plus optional ramps (sequential: colours weakest to strongest; diverging: negative and positive arms weakest to strongest around a neutral colour). Files without ramps still load. Other top-level members, such as name or notes, are ignored. An optional graphite object in each mode supplies muted, grid, axis, info, quiet, quietLine, neutral, neutral2, and neutral3 colour roles.

Parameters

json string required
The token document.
mode ChartForgeX.ThemeMode = Light optional
Which variant to load.

Returns

VisualDesignTokens The loaded tokens.

Exceptions

  • ArgumentNullException – json is null.
  • ArgumentException – The JSON is malformed, too large, has duplicate keys, lacks a required member, or holds a colour that is not #rrggbb or #rrggbbaa. Keys are case-sensitive.
public static VisualDesignTokens FromJsonFile(string path, ThemeMode mode = Light) #

Loads tokens from a generated design-token JSON file.

Parameters

path string required
The token file path.
mode ChartForgeX.ThemeMode = Light optional
Which variant to load.

Returns

VisualDesignTokens The loaded tokens.

Exceptions

  • ArgumentException – The path is empty or the content is not a valid token document.
  • IOException – The file cannot be read.
public static VisualDesignTokens GraphiteDark() #

Creates the lifted Graphite dark colour roles and ramps.

public static VisualDesignTokens GraphiteLight() #

Creates the approved Graphite light colour roles and ramps.

public ChartColorScale? ToSequentialColorScale() #

Returns a sequential numeric color scale with every ramp color, weakest to strongest, or null without a ramp.

public SvgColorVariables ToSvgColorVariables(Func<string, string?>? variableName = null) #

Creates SVG colour variables for these tokens, one per token colour, named from the token path. Paths use the member names of the token JSON with 1-based positions: surface.page, surface.card, surface.cardAlt, surface.line, text.primary, text.secondary, series.1 …, severity.{critical|high|medium|low|info}.{fill|ink}, outcome.{pass|neutral}.{fill|ink}, state.maintenance.{fill|ink}, independent legacy status.{positive|warning|negative|disabled}, accent.base, chrome.accent, ramps.sequential.1 …, ramps.diverging.negative.1 …, ramps.diverging.neutral, and ramps.diverging.positive.1 …. They are added in that order, so when two tokens share a colour the earlier one names a paint without a role. Each variable has the role of its token (SvgColorRole.Surface for surface.*, Text, Series, Status for severity, outcome, and state, SequentialRamp or DivergingRamp; accents Any), so a renderer that writes a colour for a role names the same token in every theme. Text matched by value never takes a surface token. Paired series.*.ink, ramp ink and state contrast-ink variables let filled-mark labels retain readable contrast when a host switches themes.

Parameters

variableName System.Func<string, string?>? = null optional
Returns the custom property name for a token path, or null to leave that token literal. Null names every token --cfx- followed by its path in kebab case, for example --cfx-surface-card-alt or --cfx-series-1.

Returns

SvgColorVariables The colour variables, for Chart.WithSvgColorVariables, ChartGrid.WithSvgColorVariables, or TopologyRenderOptions.SvgColorVariables.

Exceptions

  • ArgumentException – variableName returned a name that is not a valid custom property name.

Properties

public VisualChromeTokens? Chrome { get; set; } #

Gets or sets optional tooltip and focus roles; null derives them from this palette.

public ChartColor Background { get; set; } #

Gets or sets the page or canvas background color.

public ChartColor Surface { get; set; } #

Gets or sets the recessed surface color.

public ChartColor ElevatedSurface { get; set; } #

Gets or sets the elevated card surface color.

public ChartColor Foreground { get; set; } #

Gets or sets the primary foreground color.

public ChartColor MutedForeground { get; set; } #

Gets or sets the secondary foreground color.

public ChartColor Border { get; set; } #

Gets or sets the guide and border color.

public ChartColor Accent { get; set; } #

Gets or sets the primary accent color.

public ChartColor SecondaryAccent { get; set; } #

Gets or sets the secondary accent color.

public ChartColor Positive { get; set; } #

Gets or sets the positive semantic color.

public ChartColor Warning { get; set; } #

Gets or sets the warning semantic color.

public ChartColor Negative { get; set; } #

Gets or sets the negative semantic color.

public ChartColor Disabled { get; set; } #

Gets or sets the disabled semantic color.

public ChartColor[] Palette { get; set; } #

Gets or sets the qualitative data palette.

public VisualStatusTokens Status { get; set; } #

Gets or sets the severity, outcome, and operational-state colours. Use VisualStatusTokens.OperationalStateCategories and related methods with Chart.StateCategories.

public ChartColor[]? SequentialRamp { get; set; } #

Gets or sets the optional sequential ramp (weakest to strongest, one hue) for counts and magnitudes. Used for numeric heatmap scales; null keeps the default blend.

public VisualDivergingRamp? DivergingRamp { get; set; } #

Gets or sets the optional diverging ramp for values around a midpoint (see VisualDivergingRamp.ToColorScale).

public ChartColor? Other { get; set; } #

Gets or sets the neutral aggregate fill for Other, independently of operational status and empty tracks.

public ChartColor? PlotBorder { get; set; } #

Gets or sets the independent plot border; null uses the shared border.

public ChartColor? Muted { get; set; } #

Gets or sets muted annotation text; null retains the secondary foreground mapping.

public ChartColor? Grid { get; set; } #

Gets or sets horizontal plot guides; null retains the border-derived mapping.

public ChartColor? Axis { get; set; } #

Gets or sets the zero baseline; null retains the secondary-text-derived mapping.

public ChartColor? Info { get; set; } #

Gets or sets the informational state colour.

public ChartColor? Quiet { get; set; } #

Gets or sets a quiet healthy fill.

public ChartColor? QuietLine { get; set; } #

Gets or sets an understated healthy line.

public ChartColor? Neutral { get; set; } #

Gets or sets the neutral aggregate fill.

public ChartColor? Neutral2 { get; set; } #

Gets or sets the neutral track fill.

public ChartColor? Neutral3 { get; set; } #

Gets or sets the neutral zero-cell fill.