Docs · API reference · Verso.Abstractions

IThemeContext Interface#

Provides read-only access to the active visual theme, including colors, fonts, and spacing.

public interface IThemeContext

Properties#

ThemeKind Property#

Gets the current theme kind (e.g., light or dark).

Verso.Abstractions.ThemeKind ThemeKind { get; }

Property Value#

ThemeKind

Methods#

GetColor(string) Method#

Resolves a named color token to its current theme value.

string GetColor(string tokenName);

Parameters#

tokenName System.String

The color token name to resolve.

Returns#

System.String
The color value as a string (e.g., a hex color code).

GetCustomToken(string) Method#

Retrieves a custom theme token value by key.

string? GetCustomToken(string key);

Parameters#

key System.String

The custom token key.

Returns#

System.String
The token value as a string, or null if the key is not defined.

GetFont(string) Method#

Retrieves the font descriptor for the specified font role.

Verso.Abstractions.FontDescriptor GetFont(string fontRole);

Parameters#

fontRole System.String

The font role identifier (e.g., "body", "code").

Returns#

FontDescriptor
A FontDescriptor containing the font family, size, and weight.

GetSpacing(string) Method#

Retrieves the spacing value for the specified spacing token.

double GetSpacing(string spacingName);

Parameters#

spacingName System.String

The spacing token name to resolve.

Returns#

System.Double
The spacing value in device-independent units.

GetSyntaxColor(string) Method#

Resolves a syntax-highlighting token type to its color value.

string? GetSyntaxColor(string tokenType);

Parameters#

tokenType System.String

The syntax token type (e.g., "keyword", "string").

Returns#

System.String
The color value as a string, or null if the token type is not defined.