Theme Engine

April 2, 2026 · View on GitHub

PleasantUI ships 10 built-in themes, a System mode that follows the OS, and a full custom theme editor with create/edit/export/import support.

Built-in themes

Light, Dark, Mint, Strawberry, Ice, Sunny, Spruce, Cherry, Cave, Lunar, System

Switching theme in code

// Switch to a built-in theme by name
var theme = PleasantTheme.Themes.First(t => t.Name == "Dark");
PleasantSettings.Current!.Theme = theme.ThemeVariant;

Binding a theme selector in AXAML

<ComboBox ItemsSource="{x:Static PleasantTheme.Themes}"
          SelectedItem="{Binding SelectedTheme}">
    <ComboBox.ItemTemplate>
        <DataTemplate DataType="models:Theme">
            <TextBlock Text="{Localize {CompiledBinding Name}, Context=Theme}" />
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

Custom themes

Creating programmatically

var colors = PleasantTheme.GetThemeTemplateDictionary(); // start from Light
colors["AccentColor"] = Color.Parse("#FF6B35");          // override accent

var custom = new CustomTheme
{
    Name   = "My Theme",
    Colors = colors.ToColorPalette()
};

PleasantTheme.CustomThemes.Add(custom);
PleasantTheme.SelectedCustomTheme = custom;

Using the built-in editor

// Open the theme editor window (from PleasantUI.ToolKit)
CustomTheme? result = await ThemeEditorWindow.EditTheme(window, existingTheme);
if (result is not null)
    PleasantTheme.CustomThemes.Add(result);

Editing an existing custom theme

CustomTheme? updated = await ThemeEditorWindow.EditTheme(window, myTheme);
if (updated is not null)
    PleasantTheme.EditCustomTheme(myTheme, updated);

Accent color

The accent color is automatically derived from the OS accent on Windows/macOS, or can be set manually:

PleasantSettings.Current!.NumericalAccentColor = 0xFF6B35FF; // ARGB
PleasantSettings.Current!.PreferUserAccentColor = true;

Light/dark accent variants (AccentLightColor1AccentLightColor3, AccentDarkColor1AccentDarkColor3) and gradient brushes are generated automatically.

Settings persistence

PleasantSettings is loaded from and saved to disk automatically on desktop. The settings file lives at:

%AppData%/[AppName]/Settings/Settings.json   (Windows)
~/.config/[AppName]/Settings/Settings.json   (Linux/macOS)

Key settings:

SettingDescription
ThemeActive ThemeVariant
NumericalAccentColorUser accent color (ARGB int)
PreferUserAccentColorUse user color instead of OS accent
CustomThemeIdID of the active custom theme
WindowSettings.EnableBlurGlobal blur toggle
WindowSettings.EnableCustomTitleBarGlobal custom title bar toggle
WindowSettings.OpacityLevelBackground opacity (0–1)

Color tokens

All theme colors are exposed as DynamicResource keys:

KeyUsage
BackgroundColor14Window/panel backgrounds (lightest to darkest)
ControlFillColor13Control fill states (normal, hover, pressed)
TextFillColor13Text (primary, secondary, disabled)
AccentColorPrimary accent
AccentLightColor13Lighter accent variants
AccentLinearGradientBrushGradient brush for accent buttons
ControlBorderColorDefault border color
SystemFillColorCriticalError red
SystemFillColorSuccessSuccess green
SystemFillColorCautionWarning yellow
DangerColorDanger button background