Theme Mode

Switch the page between light, dark, and automatic (system) themes.

ThemeModeActionItem

Each button applies a theme immediately. The choice is persisted across pages via a cookie.

Theme mode

C#
@using DMBBootstrapBuilder
@using DMBPageBuilder
@using (Html.FlexBlockBuilder().WithGap(Old_Gap.Gap2).Begin())
{
    @Html.Button(new ThemeModeActionItem(Html, ThemeMode.Light).SetTitle("Light").SetIcon(IconStruct.Bootstrap("bi-sun")).SetVariant(VariantStyle.Secondary).SetOutlined())
    @Html.Button(new ThemeModeActionItem(Html, ThemeMode.Dark).SetTitle("Dark").SetIcon(IconStruct.Bootstrap("bi-moon-stars")).SetVariant(VariantStyle.Secondary).SetOutlined())
    @Html.Button(new ThemeModeActionItem(Html, ThemeMode.Automatic).SetTitle("Automatic").SetIcon(IconStruct.Bootstrap("bi-circle-half")).SetVariant(VariantStyle.Secondary).SetOutlined())
}