Skip to content
ChartForgeX

API Reference

Class

VisualDesignTokens

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() #
Returns: VisualDesignTokens

Creates an independent copy.

public Void CopyFrom(VisualDesignTokens source) #
Returns: Void

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

Parameters

source ChartForgeX.Themes.VisualDesignTokens requiredposition: 0
public static VisualDesignTokens Dark() #
Returns: VisualDesignTokens

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

public static VisualDesignTokens FromJson(String json, VisualThemeMode mode = Light) #
Returns: VisualDesignTokens

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 System.String requiredposition: 0
The token document.
mode ChartForgeX.Themes.VisualThemeMode = Light optionalposition: 1
Which variant to load.

Returns

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, VisualThemeMode mode = Light) #
Returns: VisualDesignTokens

Loads tokens from a generated design-token JSON file.

Parameters

path System.String requiredposition: 0
The token file path.
mode ChartForgeX.Themes.VisualThemeMode = Light optionalposition: 1
Which variant to load.

Returns

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() #
Returns: VisualDesignTokens

Creates the lifted Graphite dark colour roles and ramps.

public static VisualDesignTokens GraphiteLight() #
Returns: VisualDesignTokens

Creates the approved Graphite light colour roles and ramps.

public ChartColorScale? ToSequentialColorScale() #
Returns: ChartColorScale?

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) #
Returns: SvgColorVariables

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, Ramp; 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<System.String, System.String?>? = null optionalposition: 0
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

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 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.WithStateCategories.

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? 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.