Quick Start
Switch Themes in Code
Switch Themes in XAML
Available Themes
Flowery.Uno includes all 36 official DaisyUI themes:- Light Themes
- Dark Themes
- Light
- Acid
- Autumn
- Bumblebee
- Caramellatte
- Cmyk
- Corporate
- Cupcake
- Cyberpunk
- Emerald
- Fantasy
- Garden
- Lemonade
- Lofi
- Nord
- Pastel
- Retro
- Silk
- Valentine
- Winter
- Wireframe
DaisyThemeManager API
The centralized static class for theme management.Core Methods
Key Members
| Member | Description |
|---|---|
ApplyTheme(string) | Loads and applies a theme by name |
CurrentThemeName | Currently applied theme name |
AvailableThemes | Read-only list of all theme info |
ThemeChanged | Event fired after theme changes |
IsDarkTheme(string) | Returns whether a theme is dark |
The
ApplyTheme method is thread-safe and can be called from any thread. The UI will automatically update when the theme changes.Theme Controls
DaisyThemeDropdown
Dropdown listing all 36 themes with color previews. Automatically syncs withDaisyThemeManager.CurrentThemeName.
DaisyThemeController
Flexible toggle between two themes with multiple presentation modes:- Toggle
- Checkbox
- Swap (Animated)
- With Text
- With Icons
DaisyThemeRadio
Radio button for selecting a specific theme. UseGroupName across multiple radios for a theme picker.
Theme Persistence
When your app persists theme preferences, apply the saved theme before UI construction:DaisyThemeManager.cs:136-145
Palette Architecture
Flowery.Uno uses a palette-based architecture for dynamic theme switching:- DaisyPaletteFactory produces per-theme resources with semantic color names
- Themes are applied by updating
Application.Current.Resources - Stable brush instances are mutated (Color property) to ensure UI updates correctly
- Controls use
ThemeResourcebindings to automatically update when themes change
Key Palette Resources
Base Colors
DaisyBase100Brush- Page/window backgroundDaisyBase200Brush- Elevated surfaces (cards, sidebar)DaisyBase300Brush- BordersDaisyBaseContentBrush- Default text/icon color
Semantic Colors
DaisyPrimaryBrush- Primary accent colorDaisySecondaryBrush- Secondary accentDaisyAccentBrush- Tertiary accent
Status Colors
DaisyInfoBrush- Info status colorDaisySuccessBrush- Success status colorDaisyWarningBrush- Warning status colorDaisyErrorBrush- Error status color
Content Colors
DaisyPrimaryContentBrush- Text on primaryDaisySecondaryContentBrush- Text on secondaryDaisyAccentContentBrush- Text on accent
Using Resources in XAML
Uno Platform Considerations
StaticResource vs ThemeResource
StaticResource resolves once at load time. If you swap theme resources later, the UI will not update.
Always use ThemeResource for any Daisy palette brushes in XAML:
ThemeResource Limitations
ThemeResource updates most reliably when the app theme flips Light↔Dark. Switching between two dark themes (e.g., Dracula → Forest) may not trigger updates if you only replace a MergedDictionaries entry.
Solution: Flowery.Uno keeps brush instances stable and mutates their Color property when themes change. This is handled internally by DaisyThemeManager.
Critical detail: Do NOT remove and replace the palette
ResourceDictionary at runtime. Replacing the dictionary leaves existing ThemeResource bindings pointing at old brush instances.Lightweight Styling
WinUI/Uno supports “lightweight styling” - overriding theme resources for individual controls without creating full custom styles.Override a Single Control’s Colors
Place aResourceDictionary with ThemeDictionaries inside the control’s Resources:
Handle Pointer States
Override state-specific resources using standard suffixes:| State | Suffix Example |
|---|---|
| Hover | ButtonBackgroundPointerOver |
| Pressed | ButtonForegroundPressed |
| Disabled | ButtonBorderBrushDisabled |
Daisy Control Styling Resources
Flowery.Uno controls support lightweight styling through control-specific resource keys.Resource Naming Convention
All Daisy styling resources follow this pattern:DaisyButtonBackground– Button backgroundDaisyToggleKnobBrush– Toggle switch knob colorDaisyTableRowHoverBackground– Table row hover stateDaisyInputPrimaryBorderBrush– Primary variant border
Lookup Priority
Resources are resolved in this order:- Control.Resources – Instance-level override (highest priority)
- Application.Current.Resources – App-wide override
- Fallback – Control’s internal palette logic
Application-Level Styling
Override inApp.xaml to affect all instances of a control:
Instance-Level Styling
Override on a single control instance:Control Development Guidelines
When creating custom controls that need to respect themes:Subscribe to ThemeChanged (with proper lifecycle)
Always subscribe inLoaded and unsubscribe in Unloaded to prevent memory leaks:
DaisyThemeManager.cs:522-555
Use the Right Tokens
| Surface Type | Token |
|---|---|
| Page/window background | DaisyBase100Brush |
| Card/elevated surface | DaisyBase200Brush |
| Borders | DaisyBase300Brush |
| Text/icons | DaisyBaseContentBrush |
| Primary actions | DaisyPrimaryBrush |
| Success states | DaisySuccessBrush |
| Error states | DaisyErrorBrush |
Debugging Theme Issues
If theme switching appears “dead”:- Check if
ThemeChangedfires - persistence depends on this event - Look for exceptions -
RequestedThemecan throw silently
Common Issues
UI doesn't update on theme change
UI doesn't update on theme change
Cause: Using
StaticResource instead of ThemeResourceFix: Switch to ThemeResource for all Daisy palette brushesText stays white on light themes
Text stays white on light themes
Cause: Missing
Foreground bindingFix: Explicitly bind to DaisyBaseContentBrushTheme change works once then stops
Theme change works once then stops
Cause: Exception in theme applyFix: Check debug log for errors
Code-behind controls don't update
Code-behind controls don't update
Cause: Brushes cached at creationFix: Re-apply brushes on
ThemeChanged event
