Skip to content

Commit ece78db

Browse files
authored
Updated ThemeGenerator.Fluent.ps1 script to generate all theme color dictionaries (#9505)
1 parent 78979c8 commit ece78db

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed
Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
1-
[CmdletBinding(PositionalBinding=$false)]
2-
Param(
3-
[string][Alias('c')]$themeColor = "Light"
4-
)
1+
$themeColors=@("Light", "Dark", "HC");
52

63
$currentDir = Get-Location
74
$fluentThemeDir = Join-Path $currentDir "..\PresentationFramework.Fluent\"
85

9-
$outFilePath = Join-Path $fluentThemeDir "Themes\Fluent.$themeColor.xaml"
10-
116
$styleFilesDir = Join-Path $fluentThemeDir "Styles"
127
$resouceFilesDir = Join-Path $fluentThemeDir "Resources"
13-
$themeColorFilePath = Join-Path $resouceFilesDir "Theme\$themeColor.xaml"
14-
15-
[xml]$combinedXaml = '<ResourceDictionary
16-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
17-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
18-
xmlns:sys="clr-namespace:System;assembly=mscorlib"
19-
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
20-
xmlns:fluentcontrols="clr-namespace:Fluent.Controls"
21-
xmlns:system="clr-namespace:System;assembly=System.Runtime"
22-
xmlns:ui="clr-namespace:System.Windows.Documents;assembly=PresentationUI"
23-
xmlns:theme="clr-namespace:Microsoft.Windows.Themes"
24-
xmlns:framework="clr-namespace:MS.Internal;assembly=PresentationFramework"
25-
xmlns:base="clr-namespace:System.Windows;assembly=WindowsBase">
26-
</ResourceDictionary>'
278

28-
foreach ($file in Get-ChildItem $resouceFilesDir -Filter "*.xaml") {
29-
if($file.BaseName -eq "Fluent") {
30-
continue
9+
foreach($themeColor in $themeColors)
10+
{
11+
$outFilePath = Join-Path $fluentThemeDir "Themes\Fluent.$themeColor.xaml"
12+
$themeColorFilePath = Join-Path $resouceFilesDir "Theme\$themeColor.xaml"
13+
14+
[xml]$combinedXaml = '<ResourceDictionary
15+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
16+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
17+
xmlns:sys="clr-namespace:System;assembly=mscorlib"
18+
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
19+
xmlns:fluentcontrols="clr-namespace:Fluent.Controls"
20+
xmlns:system="clr-namespace:System;assembly=System.Runtime"
21+
xmlns:ui="clr-namespace:System.Windows.Documents;assembly=PresentationUI"
22+
xmlns:theme="clr-namespace:Microsoft.Windows.Themes"
23+
xmlns:framework="clr-namespace:MS.Internal;assembly=PresentationFramework"
24+
xmlns:base="clr-namespace:System.Windows;assembly=WindowsBase">
25+
</ResourceDictionary>'
26+
27+
foreach ($file in Get-ChildItem $resouceFilesDir -Filter "*.xaml") {
28+
if($file.BaseName -eq "Fluent") {
29+
continue
30+
}
31+
[xml]$currentXaml = Get-Content $file.FullName
32+
33+
$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
34+
}
35+
36+
[xml]$themeColorXaml = Get-Content $themeColorFilePath
37+
$combinedXaml.ResourceDictionary.InnerXml += $themeColorXaml.ResourceDictionary.InnerXml
38+
39+
foreach ($file in Get-ChildItem $styleFilesDir -Filter "*.xaml") {
40+
[xml]$currentXaml = Get-Content $file.FullName
41+
$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
3142
}
32-
[xml]$currentXaml = Get-Content $file.FullName
33-
34-
$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
35-
}
36-
37-
[xml]$themeColorXaml = Get-Content $themeColorFilePath
38-
$combinedXaml.ResourceDictionary.InnerXml += $themeColorXaml.ResourceDictionary.InnerXml
39-
40-
foreach ($file in Get-ChildItem $styleFilesDir -Filter "*.xaml") {
41-
[xml]$currentXaml = Get-Content $file.FullName
42-
43-
$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
44-
}
4543

46-
([xml]$combinedXaml).Save($outFilePath)
44+
([xml]$combinedXaml).Save($outFilePath)
45+
}

0 commit comments

Comments
 (0)