Class ThemeRegistryStateService
- Namespace
- SharpConsoleUI.Core
- Assembly
- SharpConsoleUI.dll
Per-ConsoleWindowSystem registry of available themes. Registration, lookup, and
enumeration are scoped to the owning window system, so themes registered (including those
contributed by a loaded plugin) never leak across instances. Pre-seeded with the built-in
ModernGray theme plus the palette-generated seed catalog. Thread-safe.
public class ThemeRegistryStateService
- Inheritance
-
ThemeRegistryStateService
- Inherited Members
- Extension Methods
Constructors
ThemeRegistryStateService()
Creates a registry pre-seeded with the built-in ModernGray theme and the seed catalog.
public ThemeRegistryStateService()
Properties
Count
Gets the number of registered themes.
public int Count { get; }
Property Value
DefaultThemeName
Gets or sets the name of the default theme to use when none is specified. Thread-safe.
public string DefaultThemeName { get; set; }
Property Value
Methods
GetAvailableThemeNames()
Gets all available theme names, sorted.
public IReadOnlyList<string> GetAvailableThemeNames()
Returns
GetAvailableThemes()
Gets all available themes with their information, sorted by name.
public IReadOnlyList<ThemeInfo> GetAvailableThemes()
Returns
GetDefaultTheme()
Gets a new instance of the configured default theme (DefaultThemeName).
public ITheme GetDefaultTheme()
Returns
Exceptions
- InvalidOperationException
Thrown if the default theme is not registered.
GetTheme(string)
Gets a new instance of the named theme, or null if not registered.
public ITheme? GetTheme(string name)
Parameters
namestring
Returns
GetThemeOrDefault(string, ITheme)
Gets the named theme, or defaultTheme if not registered.
public ITheme GetThemeOrDefault(string name, ITheme defaultTheme)
Parameters
Returns
IsThemeRegistered(string)
Checks whether a theme with the given name is registered.
public bool IsThemeRegistered(string name)
Parameters
namestring
Returns
RegisterTheme(string, string, Func<ITheme>)
Registers a theme. If a theme with the same name already exists, it is replaced.
public void RegisterTheme(string name, string description, Func<ITheme> factory)
Parameters
UnregisterTheme(string)
Unregisters a theme. Returns true if it was removed, false if not found.
public bool UnregisterTheme(string name)
Parameters
namestring