Class Theme
- Namespace
- SharpConsoleUI.Themes
- Assembly
- SharpConsoleUI.dll
Entry point for deriving a theme from an existing one. Copies every member of a base ITheme, lets you override any subset, and returns a mutable theme you can register and switch to.
public static class Theme
- Inheritance
-
Theme
- Inherited Members
Examples
var myDark = Theme.From(new ModernGrayTheme())
.WithName("MyDark")
.With(t => t.ButtonBackgroundColor = Color.DarkRed)
.Build();
windowSystem.ThemeRegistryService.RegisterTheme("MyDark", "My dark variant", () => myDark);
windowSystem.ThemeStateService.SwitchTheme("MyDark");
Methods
From(ITheme)
Begins deriving a theme from baseTheme. The returned builder works on a
fresh MutableTheme seeded with every member value copied from the base.
public static ThemeBuilder From(ITheme baseTheme)
Parameters
baseThemeIThemeThe theme to copy all member values from.
Returns
- ThemeBuilder
A ThemeBuilder for further customization.
Exceptions
- ArgumentNullException
baseThemeis null.
FromPalette(Palette)
Generates a complete theme from a small Palette of seed colors. Everything not supplied is derived (see Palette). Returns a mutable theme you can register and switch to like any other.
public static MutableTheme FromPalette(Palette palette)
Parameters
palettePaletteThe seed colors.
Returns
- MutableTheme
The generated (mutable) theme.
Exceptions
- ArgumentNullException
paletteis null.