ThemePanelWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A widget that applies theme customizations to its child widget tree. Use this to override theme elements (colors, characters, etc.) for a specific portion of your UI without affecting the rest of the application.
public sealed record ThemePanelWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ThemePanelWidget>Inheritance
Object → Hex1bWidget → ThemePanelWidget
Implements
Constructors
ThemePanelWidget(Func<Hex1bTheme, Hex1bTheme>, Hex1bWidget)
A widget that applies theme customizations to its child widget tree. Use this to override theme elements (colors, characters, etc.) for a specific portion of your UI without affecting the rest of the application.
Parameters:
ThemeMutator(Func<Hex1bTheme, Hex1bTheme>): A function that receives a clone of the current theme and returns a (possibly modified) theme. The returned theme is used for rendering the child subtree. The theme is already cloned, so you can safely call Set() directly.Child(Hex1bWidget): The child widget to render with the customized theme.
public ThemePanelWidget(Func<Hex1bTheme, Hex1bTheme> ThemeMutator, Hex1bWidget Child)Properties
Child
The child widget to render with the customized theme.
Returns: Hex1bWidget
public Hex1bWidget Child { get; init; }ThemeMutator
A function that receives a clone of the current theme and returns a (possibly modified) theme. The returned theme is used for rendering the child subtree. The theme is already cloned, so you can safely call Set() directly.
Returns: Func<Hex1bTheme, Hex1bTheme>
public Func<Hex1bTheme, Hex1bTheme> ThemeMutator { get; init; }Examples
// Override button colors for this section only
ctx.ThemePanel(
theme => theme
.Set(ButtonTheme.ForegroundColor, Hex1bColor.White)
.Set(ButtonTheme.BackgroundColor, Hex1bColor.Blue),
ctx.VStack(v => [
v.Button("Primary"),
v.Button("Secondary")
])
)