PromptThemeFile
ConsoleMonster.Prompts
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.
Returned or exposed by 6
- Method PromptThemeFile.FromConfiguration
- Method PromptThemeFile.FromPreset
- Method PromptThemeFile.Import
- Method PromptThemeFile.Load
- Method PromptThemeFile.Parse
- Property PromptThemeImport.Theme
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
- The theme name.
- configuration ConsoleMonster.Prompts.PromptConfiguration
- The prompt configuration.
- description string? = null
- An optional one-line description.
Returns
PromptThemeFileExceptions
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
- A name from PromptConfiguration.Presets.
Returns
PromptThemeFilepublic static PromptThemeFile Import(IDictionary data) #Validates data supplied by an adapter, such as a PowerShell hashtable.
Parameters
- data System.Collections.IDictionary
- SchemaVersion (optional, 1), Name, optional Description and the prompt settings.
Returns
PromptThemeFileExceptions
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
- A file-system path.
Returns
PromptThemeFileExceptions
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
- One JSON object. Comments, duplicate keys and trailing content are rejected.
Returns
PromptThemeFileExceptions
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
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.Inherited Methods
Properties
public PromptConfiguration Configuration { get; } #The validated prompt configuration.