Generated by AurionDocs
Job ID: 934f8c39-8082-4942-8d17-72ed8f5f8d50
Source commit: 40aea9a
2.4 KiB
Theme.cs
Source:
src/EchoHub.Client/Themes/Theme.cs
Contents
Theme
File:
src/EchoHub.Client/Themes/Theme.cs
Kind: class
public class Theme
The Theme class encapsulates the color palette used by the UI. It groups per-surface color sets for the main surfaces (Base, Menu, Dialog, Status) and exposes an optional Border color that can override the window frame independently of text. By providing a name and a complete set of colors, a developer can switch or define visual styles at runtime and apply them to the UI. If you do not need a separate border color, leave Border as null to fall back to Base.
Remarks
The Theme object acts as a central theme descriptor that isolates surface-specific colors from the core palette, making it easy to create variants (e.g., light, dark, or glassy appearances) without scattering color values through the code. The optional Border enables stylistic nuances for window chrome without altering text or control coloring, helping to achieve subtler, themed aesthetics while preserving readability.
Example
var theme = new Theme
{
Name = "Glass",
Base = new ThemeColors(), // default color family for surfaces
Border = null // explicit fallback to Base colors for borders
};
ThemeColors
File:
src/EchoHub.Client/Themes/Theme.cs
Kind: class
public class ThemeColors
ThemeColors is a small data container that groups the color tokens used by the UI: Foreground, Background, FocusForeground, and FocusBackground. Create and pass a single ThemeColors instance to ensure consistent theming across components rather than scattering color literals throughout the code.
Remarks
By centralizing color choices in ThemeColors, the UI can swap themes or provide variations without touching individual controls. The default initializers encode a high-contrast dark theme (white text on black, focus highlight in blue), but you can override any property to tailor a theme for a particular context.
Notes
- Mutability: the properties have public setters, so the color values can be changed after construction; if a
ThemeColorsinstance is shared, mutations will affect all dependents. - Defaults are defined via property initializers; override them on construction if you want a different baseline.