Skip to content
ConsoleMonster
Class

PromptThemeFile

ConsoleMonster.Prompts

Namespace
ConsoleMonster.Prompts
Assembly
ConsoleMonster
Modifiers
sealed

An immutable, validated prompt theme document: a named, shareable prompt configuration. Loading never installs the prompt or changes the session.

Inheritance

  • object
  • PromptThemeFile

Remarks

Documents contain SchemaVersion (1), Name, an optional Description and the prompt settings: Style, Layout, Marker, Left, Right, Transient, Hints, ShellIntegration and Segments. Keys are case-insensitive. Omitted settings use the defaults; an omitted Transient disables transient prompts. Segment options are scalar values. The Background and Foreground options take a theme role (Accent, Info) or a colour (#61afef, orange1, 208); without them, segments follow the active theme.

Usage

Explore 6 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.

Methods

public static PromptThemeFile FromConfiguration(string name, PromptConfiguration configuration, string? description = null) #

Validates a configuration and names it as a theme document.

Parameters

name string required
The theme name.
configuration ConsoleMonster.Prompts.PromptConfiguration required
The prompt configuration.
description string? = null optional
An optional one-line description.

Exceptions

  • FormatException – The name is empty or the configuration names an unknown segment or invalid option.
public static PromptThemeFile FromPreset(string preset) #

Returns a built-in preset as a theme document, for sharing or as a starting point.

Parameters

preset string required
A name from PromptConfiguration.Presets.
public static PromptThemeFile Import(IDictionary data) #

Validates data supplied by an adapter, such as a PowerShell hashtable.

Parameters

data System.Collections.IDictionary required
SchemaVersion (optional, 1), Name, optional Description and the prompt settings.

Exceptions

  • FormatException – An unknown key, segment or invalid value is present.
public static PromptThemeFile Load(string path) #

Reads a UTF-8 JSON prompt theme file without changing the session.

Parameters

path string required
A file-system path.

Exceptions

  • FormatException – The document is invalid.
public static PromptThemeFile Parse(string json) #

Parses JSON and validates every key, segment and option before returning.

Parameters

json string required
One JSON object. Comments, duplicate keys and trailing content are rejected.

Exceptions

  • FormatException – The JSON or prompt data is invalid.
public void Save(string path) #

Writes this document as UTF-8 JSON without a byte order mark. The parent directory must already exist.

Parameters

path string required
public IDictionary<string, object?> ToData() #

Returns a complete data-only dictionary suitable for an adapter's native serialization.

Returns

IDictionary<string, object?>
public string ToJson() #

Writes complete, indented JSON.

Returns

string The JSON document, ending in a newline.

Properties

public string Name { get; } #

The theme name.

public string? Description { get; } #

An optional one-line description.

public PromptConfiguration Configuration { get; } #

The validated prompt configuration.