Theme Colors
Description
The Theme utility class allows you to manage the application's theme, including switching between Light and Dark modes and customizing the color palette. It uses CSS variables to apply colors dynamically across the UI.
Usage
Switching Themes
You can switch between light and dark themes using static methods.
Customizing Colors
You can customize the primary and background colors.
Methods
- Theme.Light()
- Switches the application to the light theme.
- Theme.Dark()
- Switches the application to the dark theme.
- Theme.SetPrimary(Color light, Color dark)
- Sets the primary color for both light and dark themes.
- Theme.SetBackground(Color light, Color dark)
- Sets the background color for both light and dark themes.
Properties
- Theme.IsLight
- (bool) Returns true if the current theme is light.
- Theme.IsDark
- (bool) Returns true if the current theme is dark.
- Theme.Primary
- Accessor for primary theme colors (Background, Foreground, Border, etc.).
- Theme.Default
- Accessor for default theme colors.
- Theme.Secondary
- Accessor for secondary theme colors.
- Theme.Danger
- Accessor for danger theme colors.
- Theme.Success
- Accessor for success theme colors.
Samples
Theme Switcher Sample
This sample demonstrates how to create a simple theme switcher.