Project

ChartForgeX

Render deterministic charts, dashboards, topology, hierarchy, and report visuals directly from .NET.

Stars 47
Forks 2
NuGet downloads 75,067
Release ChartForgeX-v2.0.0
Language: HTML Updated: 2026-10-12

API Reference

Class

VisualDesignTokens

Namespace ChartForgeX.Themes
Assembly ChartForgeX
Modifiers sealed

Defines product-neutral brand, semantic color, typography, and shape tokens that can be applied across ChartForgeX visual surfaces.

Inheritance

  • Object
  • VisualDesignTokens

Usage

Explore 15 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 9

Constructors

public VisualDesignTokens() #

Methods

ApplyTo 2 overloads
public ChartTheme ApplyTo(ChartTheme theme) #
Returns: ChartTheme

Applies the shared tokens to a chart renderer theme.

Parameters

theme ChartForgeX.Themes.ChartTheme requiredposition: 0
public TopologyTheme ApplyTo(TopologyTheme theme) #
Returns: TopologyTheme

Applies the shared tokens to a topology renderer theme.

Parameters

theme ChartForgeX.Topology.TopologyTheme requiredposition: 0
public VisualDesignTokens Clone() #
Returns: VisualDesignTokens

Creates an independent copy.

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 enables the flat look and 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 String FontFamily { get; set; } #

Gets or sets the primary CSS-compatible font family stack.

public String MonospaceFontFamily { get; set; } #

Gets or sets the CSS-compatible monospace font family stack.

public Double CornerRadius { get; set; } #

Gets or sets the base corner radius.

public Double StrokeWidth { get; set; } #

Gets or sets the base data-mark stroke width.

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. Applied to ChartTheme.SequentialRamp; null clears it so heatmaps use the default blend.

public VisualDivergingRamp? DivergingRamp { get; set; } #

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

public Boolean UseGraphiteLayout { get; set; } #

Gets or sets whether charts use the flat Graphite look when these tokens are applied.

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.

Extension Methods

ApplyTo 3 overloads
public static TerminalTheme ApplyTo(VisualDesignTokens tokens, TerminalTheme theme) #
Returns: TerminalTheme

Maps shared surfaces, monospace typography and output tones onto an existing terminal theme. Semantic output uses status inks suitable for text on the content surface, rather than mark fills. Apply caller-specific overrides after this mapping.

Parameters

tokens ChartForgeX.Themes.VisualDesignTokens requiredposition: 0
theme ChartForgeX.Terminal.TerminalTheme requiredposition: 1
public static VisualStoryTheme ApplyTo(VisualDesignTokens tokens, VisualStoryTheme theme) #
Returns: VisualStoryTheme

Maps shared surfaces, typography and text roles onto an existing story theme. Success uses the status ink for text; syntax uses the data palette, falling back to primary text when a palette color has less than 4.5:1 contrast on the panel. Apply caller-specific overrides after this mapping.

Parameters

tokens ChartForgeX.Themes.VisualDesignTokens requiredposition: 0
theme ChartForgeX.Stories.VisualStoryTheme requiredposition: 1
public static VisualCanvasTheme ApplyTo(VisualDesignTokens tokens, VisualCanvasTheme theme) #
Returns: VisualCanvasTheme

Maps shared colors and typography onto an existing canvas theme.

Parameters

tokens ChartForgeX.Themes.VisualDesignTokens requiredposition: 0
theme ChartForgeX.Composition.VisualCanvasTheme requiredposition: 1