Skip to content

Commit f16613e

Browse files
mdtauk0x5bfa
authored andcommitted
Updated ThemedIcon example and separated ThemeResources
1 parent 135bb1a commit f16613e

File tree

5 files changed

+978
-384
lines changed

5 files changed

+978
-384
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!-- Copyright (c) 2024 Files Community. Licensed under the MIT License. See the LICENSE. -->
2+
<ResourceDictionary
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Files.App.Controls">
6+
7+
8+
<ResourceDictionary.MergedDictionaries>
9+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
10+
</ResourceDictionary.MergedDictionaries>
11+
12+
13+
<ResourceDictionary.ThemeDictionaries>
14+
15+
<ResourceDictionary x:Key="Default">
16+
<Color x:Key="ThemedIconBaseColor">#DBF0F0F0</Color>
17+
<Color x:Key="ThemedIconAltColor">#66161616</Color>
18+
19+
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="ThemedIconBaseColor" />
20+
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="ThemedIconAltColor" />
21+
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="AccentFillColorDefaultBrush" />
22+
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
23+
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="TextFillColorDisabledBrush" />
24+
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="TextOnAccentFillColorDisabledBrush" />
25+
26+
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemFillColorCritical" />
27+
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemFillColorCaution" />
28+
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemFillColorSuccess" />
29+
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemFillColorSolidNeutral" />
30+
31+
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemFillColorCriticalBackgroundBrush" />
32+
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemFillColorCautionBackgroundBrush" />
33+
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemFillColorSuccessBackgroundBrush" />
34+
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SolidBackgroundFillColorQuarternaryBrush" />
35+
36+
<x:Boolean x:Key="ThemedIconHighContrast">False</x:Boolean>
37+
</ResourceDictionary>
38+
39+
40+
41+
<ResourceDictionary x:Key="HighContrast">
42+
<Color x:Key="ThemedIconBaseColor">#FF000000</Color>
43+
<Color x:Key="ThemedIconAltColor">#00000000</Color>
44+
45+
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="SystemColorButtonTextColorBrush" />
46+
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="SystemColorButtonFaceColorBrush" />
47+
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="SystemColorHighlightColorBrush" />
48+
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="SystemColorHighlightTextColorBrush" />
49+
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="SystemColorGrayTextColorBrush" />
50+
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="SystemColorHighlightTextColorBrush" />
51+
52+
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemColorHighlightColorBrush" />
53+
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemColorHighlightColorBrush" />
54+
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemColorHighlightColorBrush" />
55+
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemColorHighlightColorBrush" />
56+
57+
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
58+
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
59+
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
60+
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SolidBackgroundFillColorBaseBrush" />
61+
62+
<x:Boolean x:Key="ThemedIconHighContrast">True</x:Boolean>
63+
</ResourceDictionary>
64+
65+
66+
67+
<ResourceDictionary x:Key="Light">
68+
<Color x:Key="ThemedIconBaseColor">#DB161616</Color>
69+
<Color x:Key="ThemedIconAltColor">#66F0F0F0</Color>
70+
71+
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="ThemedIconBaseColor" />
72+
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="ThemedIconAltColor" />
73+
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="AccentFillColorDefaultBrush" />
74+
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
75+
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="TextFillColorDisabledBrush" />
76+
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="TextOnAccentFillColorDisabledBrush" />
77+
78+
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemFillColorCritical" />
79+
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemFillColorCaution" />
80+
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemFillColorSuccess" />
81+
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemFillColorSolidNeutral" />
82+
83+
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemFillColorCriticalBackgroundBrush" />
84+
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemFillColorCautionBackgroundBrush" />
85+
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemFillColorSuccessBackgroundBrush" />
86+
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SolidBackgroundFillColorQuarternaryBrush" />
87+
88+
<x:Boolean x:Key="ThemedIconHighContrast">False</x:Boolean>
89+
</ResourceDictionary>
90+
91+
</ResourceDictionary.ThemeDictionaries>
92+
93+
</ResourceDictionary>

src/Files.App.Controls/ThemedIcon/ThemedIcon.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:local="using:Files.App.Controls">
66

7+
8+
<Style BasedOn="{StaticResource DefaultThemedIconStyle}" TargetType="local:ThemedIcon" />
9+
710
<Style x:Key="DefaultThemedIconStyle" TargetType="local:ThemedIcon">
811

912
<Setter Property="IsTabStop" Value="False" />
@@ -193,8 +196,6 @@
193196

194197
</Style>
195198

196-
<Style BasedOn="{StaticResource DefaultThemedIconStyle}" TargetType="local:ThemedIcon" />
197-
198199
<!-- Empty -->
199200
<Style
200201
x:Key="App.ThemedIcons.Empty"

src/Files.App.Controls/Themes/Generic.xaml

Lines changed: 4 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,13 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:local="using:Files.App.Controls">
66

7-
<ResourceDictionary.ThemeDictionaries>
8-
9-
<ResourceDictionary x:Key="Default">
10-
<Color x:Key="ThemedIconBaseColor">#DBF0F0F0</Color>
11-
<Color x:Key="ThemedIconAltColor">#66161616</Color>
12-
13-
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="ThemedIconBaseColor" />
14-
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="ThemedIconAltColor" />
15-
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="AccentFillColorDefaultBrush" />
16-
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
17-
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="TextFillColorDisabledBrush" />
18-
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="TextOnAccentFillColorDisabledBrush" />
19-
20-
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemFillColorCritical" />
21-
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemFillColorCaution" />
22-
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemFillColorSuccess" />
23-
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemFillColorSolidNeutral" />
24-
25-
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemFillColorCriticalBackgroundBrush" />
26-
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemFillColorCautionBackgroundBrush" />
27-
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemFillColorSuccessBackgroundBrush" />
28-
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SystemFillColorNeutralBackgroundBrush" />
29-
30-
<x:Boolean x:Key="ThemedIconHighContrast">False</x:Boolean>
31-
</ResourceDictionary>
32-
33-
<ResourceDictionary x:Key="Light">
34-
<Color x:Key="ThemedIconBaseColor">#DB161616</Color>
35-
<Color x:Key="ThemedIconAltColor">#66F0F0F0</Color>
36-
37-
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="ThemedIconBaseColor" />
38-
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="ThemedIconAltColor" />
39-
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="AccentFillColorDefaultBrush" />
40-
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
41-
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="TextFillColorDisabledBrush" />
42-
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="TextOnAccentFillColorDisabledBrush" />
43-
44-
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemFillColorCritical" />
45-
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemFillColorCaution" />
46-
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemFillColorSuccess" />
47-
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemFillColorSolidNeutral" />
48-
49-
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemFillColorCriticalBackgroundBrush" />
50-
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemFillColorCautionBackgroundBrush" />
51-
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemFillColorSuccessBackgroundBrush" />
52-
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SystemFillColorNeutralBackgroundBrush" />
53-
54-
<x:Boolean x:Key="ThemedIconHighContrast">False</x:Boolean>
55-
</ResourceDictionary>
56-
57-
<ResourceDictionary x:Key="HighContrast">
58-
<Color x:Key="ThemedIconBaseColor">#FF000000</Color>
59-
<Color x:Key="ThemedIconAltColor">#00000000</Color>
60-
61-
<StaticResource x:Key="ThemedIconBaseBrush" ResourceKey="SystemColorButtonTextColorBrush" />
62-
<StaticResource x:Key="ThemedIconAltBrush" ResourceKey="SystemColorButtonFaceColorBrush" />
63-
<StaticResource x:Key="ThemedIconAccentBrush" ResourceKey="SystemColorHighlightColorBrush" />
64-
<StaticResource x:Key="ThemedIconAccentContrastBrush" ResourceKey="SystemColorHighlightTextColorBrush" />
65-
<StaticResource x:Key="ThemedIconDisabledBrush" ResourceKey="SystemColorGrayTextColorBrush" />
66-
<StaticResource x:Key="ThemedIconDisabledToggleBrush" ResourceKey="SystemColorHighlightTextColorBrush" />
67-
68-
<StaticResource x:Key="ThemedIconCriticalBrush" ResourceKey="SystemColorHighlightColorBrush" />
69-
<StaticResource x:Key="ThemedIconCautionBrush" ResourceKey="SystemColorHighlightColorBrush" />
70-
<StaticResource x:Key="ThemedIconSuccessBrush" ResourceKey="SystemColorHighlightColorBrush" />
71-
<StaticResource x:Key="ThemedIconNeutralBrush" ResourceKey="SystemColorHighlightColorBrush" />
72-
73-
<StaticResource x:Key="ThemedIconCriticalBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
74-
<StaticResource x:Key="ThemedIconCautionBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
75-
<StaticResource x:Key="ThemedIconSuccessBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
76-
<StaticResource x:Key="ThemedIconNeutralBackgroundBrush" ResourceKey="SystemColorWindowColorBrush" />
77-
78-
<x:Boolean x:Key="ThemedIconHighContrast">True</x:Boolean>
79-
</ResourceDictionary>
80-
81-
</ResourceDictionary.ThemeDictionaries>
827

838
<ResourceDictionary.MergedDictionaries>
849
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
85-
<!--#region ThemedIconStyles-->
10+
11+
<!--#region ThemedIcon-->
12+
<ResourceDictionary Source="ms-appx:///Files.App.Controls/ThemedIcon/ThemedIcon.ThemeResources.xaml" />
13+
8614
<ResourceDictionary Source="ms-appx:///Files.App.Controls/ThemedIcon/ThemedIcon.xaml" />
8715
<ResourceDictionary Source="ms-appx:///Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.xaml" />
8816
<!-- Icon Style Sets -->

0 commit comments

Comments
 (0)