EarTrumpet uses a custom Theme:Brush system to support Windows theme configurations (High Contrast, Light/Dark, Accent Color, and Transparency) in XAML. This allows UI elements to adapt dynamically at runtime.
Basic Usage:
Apply brush values directly to XAML elements:
<TextBlock Theme:Brush.Foreground="SystemAccent" />
Color Values:
- Static Colors: Use names like
Red, #FFaabbcc, or SystemAccentDark1. - Theme-Specific Values: Specify values for different modes using the format
Light=Value, Dark=Value, HighContrast=Value or using the {Theme} variable:<!-- Using the {Theme} variable -->
Theme={Theme}ChromeWhite, HighContrast=Highlight
- Transparency: You can optionally modify the alpha channel using a value between
0.0-1.0. For example, Light=LightChromeWhite/0.8 makes the color 80% opaque in Light mode.
Supported Color Sources:
System.Windows.Media.ColorConverter.ConvertFromString("*ColorName*") (e.g., #aa000000)EarTrumpet.Interop.ImmersiveSystemColors.Lookup("*ColorName*") (e.g., SystemAccent1)System.Windows.Media.Colors.*ColorName* (e.g., Red)System.Windows.Media.SystemColors.*ColorName* (e.g., HotTrack)<Theme:Ref Key="*ColorName*"> references defined in App.xaml.
Advanced Theming (Rules and Scopes):
- Theme:Options.Scope: Allows different colors for the flyout versus other UI surfaces. Example:
Flyout:Theme=Red, Flyout:HighContrast=HotTrack, :Theme=Blue, :HighContrast=HotTrack (where : denotes the default scope). - Theme:Options.Source: Set at the top level window to
App or System. Taskbar and flyout use System; other windows use App.