Skip to content

Commit b009263

Browse files
kevinmbuthiKeboo
authored andcommitted
(WIP)Remove hard coded hex for buttons (#1132)
* Remove hard coded hex for buttons foreground * cleanup and add more generic brush declarations * Delete packages.config * Switching resource to dynamic resource
1 parent 92a21ca commit b009263

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Button.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
</Style>
166166

167167
<Style x:Key="MaterialDesignToolButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource MaterialDesignFlatButton}">
168-
<Setter Property="Foreground" Value="#616161" />
168+
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignToolForeground}"/>
169169
<Setter Property="Padding" Value="4"/>
170170
<Setter Property="wpf:RippleAssist.ClipToBounds" Value="False"/>
171171
<Setter Property="Template">

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<SolidColorBrush x:Key="MaterialDesignDivider" Color="#1FFFFFFF" po:Freeze="True" /><!-- 12% -->
2121
<SolidColorBrush x:Key="MaterialDesignSelection" Color="#757575" po:Freeze="True" />
2222

23+
<SolidColorBrush x:Key="MaterialDesignToolForeground" Color="#616161" po:Freeze="true" />
24+
<SolidColorBrush x:Key="MaterialDesignToolBackground" Color="#e0e0e0" po:Freeze="true" />
25+
2326
<SolidColorBrush x:Key="MaterialDesignFlatButtonClick" Color="#19757575" po:Freeze="True" /> <!-- 25% -->
2427
<SolidColorBrush x:Key="MaterialDesignFlatButtonRipple" Color="#FFB6B6B6" po:Freeze="True" />
2528

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<SolidColorBrush x:Key="MaterialDesignDivider" Color="#1F000000" po:Freeze="True" /> <!-- 12% -->
2121
<SolidColorBrush x:Key="MaterialDesignSelection" Color="#FFDeDeDe" po:Freeze="True" />
2222

23+
<SolidColorBrush x:Key="MaterialDesignToolForeground" Color="#616161" po:Freeze="true" />
24+
<SolidColorBrush x:Key="MaterialDesignToolBackground" Color="#e0e0e0" po:Freeze="true" />
25+
2326
<SolidColorBrush x:Key="MaterialDesignFlatButtonClick" Color="#FFDeDeDe" po:Freeze="True" />
2427
<SolidColorBrush x:Key="MaterialDesignFlatButtonRipple" Color="#FFB6B6B6" po:Freeze="True" />
2528

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.PopupBox.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
<wpf:PackIcon Kind="DotsVertical" x:Key="MaterialDesignPopupBoxToggleContent" x:Shared="False" Margin="4 0 4 0" Width="24" Height="24"
6767
Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Foreground}" />
68-
68+
6969
<Style TargetType="{x:Type wpf:PopupBox}" x:Key="MaterialDesignPopupBox">
7070
<Setter Property="ToggleContent" Value="{StaticResource MaterialDesignPopupBoxToggleContent}" />
7171
<Setter Property="wpf:RippleAssist.Feedback" Value="{DynamicResource MaterialDesignFlatButtonRipple}" />
@@ -134,17 +134,17 @@
134134
</Style>
135135

136136
<Style x:Key="MaterialDesignToolPopupBox" BasedOn="{StaticResource MaterialDesignPopupBox}" TargetType="wpf:PopupBox">
137-
<Setter Property="Foreground" Value="#616161" />
137+
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignToolForeground}" />
138138
<Setter Property="Padding" Value="4"/>
139139
</Style>
140140

141141
<Style x:Key="MaterialDesignToolForegroundPopupBox" BasedOn="{StaticResource MaterialDesignToolPopupBox}" TargetType="wpf:PopupBox">
142142
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
143143
</Style>
144-
144+
145145
<wpf:PackIcon x:Shared="False" x:Key="MaterialDesignMultiFloatingActionPopupBoxIcon"
146146
Kind="Plus" Width="24" Height="24" Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpf:PopupBox}, Path=Foreground}" />
147-
147+
148148
<Style TargetType="{x:Type wpf:PopupBox}" x:Key="MaterialDesignMultiFloatingActionPopupBox">
149149
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/>
150150
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/>
@@ -302,7 +302,7 @@
302302
<DoubleAnimation.EasingFunction>
303303
<SineEase EasingMode="EaseInOut" />
304304
</DoubleAnimation.EasingFunction>
305-
</DoubleAnimation>
305+
</DoubleAnimation>
306306
</Storyboard>
307307
</ControlTemplate.Resources>
308308
<Grid>
@@ -420,6 +420,6 @@
420420
<Setter Property="Background" Value="{DynamicResource SecondaryAccentBrush}"/>
421421
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentBrush}"/>
422422
<Setter Property="Foreground" Value="{DynamicResource SecondaryAccentForegroundBrush}"/>
423-
</Style>
423+
</Style>
424424

425425
</ResourceDictionary>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToggleButton.xaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@
169169
</Style>
170170

171171
<Style x:Key="MaterialDesignFlatToggleButton" TargetType="{x:Type ToggleButton}">
172-
<Setter Property="Foreground" Value="#616161"/>
173-
<Setter Property="Background" Value="#e0e0e0"/>
172+
<Setter Property="Background" Value="{DynamicResource MaterialDesignToolBackground}" />
173+
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignToolForeground}" />
174174
<Setter Property="Width" Value="40"/>
175175
<Setter Property="Height" Value="40"/>
176176
<Setter Property="FontSize" Value="18"/>
@@ -384,7 +384,8 @@
384384
<Setter TargetName="ContentPresenter" Property="ContentTemplate" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ToggleButtonAssist.OnContentTemplate)}" />
385385
</MultiTrigger>
386386
<Trigger Property="IsChecked" Value="False">
387-
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}"/> <!-- Need to set Foreground to Background here instead of hardcoded PrimaryHueMidBrush -->
387+
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}"/>
388+
<!-- Need to set Foreground to Background here instead of hardcoded PrimaryHueMidBrush -->
388389
</Trigger>
389390
<Trigger Property="Button.IsDefaulted" Value="true"/>
390391
<Trigger Property="IsMouseOver" Value="true"/>

0 commit comments

Comments
 (0)