theme: propagate palette across UI\n\n- Add selection, menus, flyouts, inputs styling\n- Tinted list selection + menu hover via primary\n- TextBox focus ring uses accent\n- Recolor function group headers via brand palette

This commit is contained in:
Codex CLI 2025-08-28 05:03:00 -05:00
commit 301347ad73
2 changed files with 59 additions and 9 deletions

View file

@ -12,20 +12,22 @@ public class CategoryToBrushConverter : IValueConverter
{
if (value is not FunctionCategory cat) return Brushes.Gray;
// Soft header background colors per category
// Soft header backgrounds derived from brand palette (with transparency)
// Brand colors:
// Primary1: #5AC3D6, Primary2: #223544, Primary3: #4E6D84
// Emph1: #F5A623, Emph2: #D94E87, Emph3: #49C46D
return cat switch
{
FunctionCategory.Base => new SolidColorBrush(Color.FromRgb(0xE3, 0xF2, 0xFD)), // light blue 50
FunctionCategory.Angle => new SolidColorBrush(Color.FromRgb(0xE8, 0xF5, 0xE9)), // green 50
FunctionCategory.Rounding => new SolidColorBrush(Color.FromRgb(0xFF, 0xF3, 0xE0)), // orange 50
FunctionCategory.Trigonometry => new SolidColorBrush(Color.FromRgb(0xF3, 0xE5, 0xF5)), // purple 50
FunctionCategory.HyperbolicTrig => new SolidColorBrush(Color.FromRgb(0xE0, 0xF7, 0xFA)), // cyan 50
FunctionCategory.NumberTheory => new SolidColorBrush(Color.FromRgb(0xFF, 0xFD, 0xE7)), // yellow 50
FunctionCategory.Random => new SolidColorBrush(Color.FromRgb(0xFC, 0xE4, 0xEC)), // pink 50
FunctionCategory.Base => new SolidColorBrush(Color.FromArgb(0x26, 0x5A, 0xC3, 0xD6)), // Primary1 @ ~15%
FunctionCategory.Angle => new SolidColorBrush(Color.FromArgb(0x26, 0x49, 0xC4, 0x6D)), // Emph3 @ ~15%
FunctionCategory.Rounding => new SolidColorBrush(Color.FromArgb(0x26, 0xF5, 0xA6, 0x23)), // Emph1 @ ~15%
FunctionCategory.Trigonometry => new SolidColorBrush(Color.FromArgb(0x26, 0x4E, 0x6D, 0x84)), // Primary3 @ ~15%
FunctionCategory.HyperbolicTrig => new SolidColorBrush(Color.FromArgb(0x1A, 0x5A, 0xC3, 0xD6)), // Primary1 @ ~10%
FunctionCategory.NumberTheory => new SolidColorBrush(Color.FromArgb(0x1A, 0xF5, 0xA6, 0x23)), // Emph1 @ ~10%
FunctionCategory.Random => new SolidColorBrush(Color.FromArgb(0x26, 0xD9, 0x4E, 0x87)), // Emph2 @ ~15%
_ => Brushes.Gray
};
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotSupportedException();
}

View file

@ -23,6 +23,11 @@
<SolidColorBrush x:Key="Brush.Foreground">#FF0F1A21</SolidColorBrush>
<SolidColorBrush x:Key="Brush.ForegroundOnPrimary">#FFFFFFFF</SolidColorBrush>
<!-- Utility tints -->
<SolidColorBrush x:Key="Brush.AccentSoft" Color="{DynamicResource CPrimary1}" Opacity="0.16"/>
<SolidColorBrush x:Key="Brush.AccentSofter" Color="{DynamicResource CPrimary1}" Opacity="0.10"/>
<SolidColorBrush x:Key="Brush.BorderSoft" Color="{DynamicResource CPrimary3}" Opacity="0.35"/>
<!-- Accent + theme integration (FluentTheme consumes these) -->
<SolidColorBrush x:Key="ThemeAccentBrush" Color="{DynamicResource CPrimary1}"/>
<SolidColorBrush x:Key="ThemeBackgroundBrush" Color="{DynamicResource Brush.Surface.Color}"/>
@ -86,4 +91,47 @@
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="8"/>
</Style>
<!-- Inputs -->
<Style Selector="TextBox">
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.BorderSoft}"/>
</Style>
<Style Selector="TextBox:focus">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
</Style>
<!-- Lists & selection -->
<Style Selector="ListBoxItem">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem:pointerover">
<Setter Property="Background" Value="{DynamicResource Brush.AccentSofter}"/>
</Style>
<Style Selector="ListBoxItem:selected">
<Setter Property="Background" Value="{DynamicResource Brush.AccentSoft}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
</Style>
<Style Selector="ListBox">
<Setter Property="Background" Value="Transparent"/>
</Style>
<!-- Menus & flyouts -->
<Style Selector="ContextMenu">
<Setter Property="Background" Value="{DynamicResource Brush.Surface}"/>
</Style>
<Style Selector="MenuItem:pointerover">
<Setter Property="Background" Value="{DynamicResource Brush.AccentSofter}"/>
</Style>
<Style Selector="FlyoutPresenter">
<Setter Property="Background" Value="{DynamicResource Brush.Surface}"/>
</Style>
<!-- Scrollbars -->
<Style Selector="ScrollBar">
<Setter Property="Foreground" Value="{DynamicResource Brush.Primary3}"/>
<Setter Property="Background" Value="#00000000"/>
</Style>
</Styles>