Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ThemeGenerator script for generating combined Fluent XAML theme files #9293

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string][Alias('c')]$themeColor = "Light"
)

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

$outFilePath = Join-Path $fluentThemeDir "Themes\Fluent.$themeColor.xaml"

$styleFilesDir = Join-Path $fluentThemeDir "Styles"
$resouceFilesDir = Join-Path $fluentThemeDir "Resources"
$themeColorFilePath = Join-Path $resouceFilesDir "Theme\$themeColor.xaml"

[xml]$combinedXaml = '<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
xmlns:system="clr-namespace:System;assembly=System.Runtime">
</ResourceDictionary>'

foreach ($file in Get-ChildItem $resouceFilesDir -Filter "*.xaml") {
if($file.BaseName -eq "Fluent") {
continue
}
[xml]$currentXaml = Get-Content $file

$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
}

[xml]$themeColorXaml = Get-Content $themeColorFilePath
$combinedXaml.ResourceDictionary.InnerXml += $themeColorXaml.ResourceDictionary.InnerXml

foreach ($file in Get-ChildItem $styleFilesDir -Filter "*.xaml") {
[xml]$currentXaml = Get-Content $file

$combinedXaml.ResourceDictionary.InnerXml += $currentXaml.ResourceDictionary.InnerXml
}

# $combinedXaml += '</ResourceDictionary>'

([xml]$combinedXaml).Save($outFilePath)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
x:Key="AccentFillColorTertiaryBrush"
Opacity="0.8"
Color="{StaticResource SystemAccentColorPrimary}" />
<SolidColorBrush x:Key="AccentFillColorDisabledBrush" Color="{StaticResource AccentFillColorDisabled}" />

<!-- <SolidColorBrush x:Key="AccentFillColorDisabledBrush" Color="{StaticResource AccentFillColorDisabled}" /> -->


<SolidColorBrush x:Key="SystemFillColorAttentionBrush" Color="{StaticResource SystemAccentColor}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<Thickness x:Key="ComboBoxEditableTextPadding">10,0,30,0</Thickness>

<system:Double x:Key="ComboBoxMinHeight">24</system:Double>
<Thickness x:Key="ComboBoxPadding">12,1,0,3</Thickness>
<!-- <Thickness x:Key="ComboBoxPadding">12,1,0,3</Thickness> -->
<system:Double x:Key="NavigationViewItemOnLeftMinHeight">32</system:Double>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=System.Runtime">

<system:String x:Key="CaretUpGlyph">&#xEDDB;</system:String>
<system:String x:Key="CaretDownGlyph">&#xEDDC;</system:String>


<!-- HINT: Day button style -->
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="CalendarDayButton">
<Setter Property="MinWidth" Value="30" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<Color x:Key="ControlPressedColor">#FF211AA9</Color>
<Color x:Key="GlyphColor">#FF444444</Color>

<system:String x:Key="CheckBoxCheckedGlyph">&#xE73E;</system:String>
<system:String x:Key="CheckBoxIndeterminateGlyph">&#xE9AE;</system:String>
<system:String x:Key="DataGridCheckBoxCheckedGlyph">&#xE73E;</system:String>
<system:String x:Key="DataGridCheckBoxIndeterminateGlyph">&#xE9AE;</system:String>

<LinearGradientBrush x:Key="MenuPopupBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="{DynamicResource ControlLightColor}" />
Expand Down Expand Up @@ -621,14 +621,14 @@

<controls:FallbackBrushConverter x:Key="FallbackBrushConverter" />

<Color x:Key="FallbackColor">#FFFF0000</Color>
<!-- <Color x:Key="FallbackColor">#FFFF0000</Color> -->

<Thickness x:Key="CheckBoxPadding">11,5,11,6</Thickness>
<Thickness x:Key="CheckBoxBorderThemeThickness">1</Thickness>
<Thickness x:Key="CheckBoxContentMargin">8,0,0,0</Thickness>
<system:Double x:Key="CheckBoxIconSize">14</system:Double>
<system:Double x:Key="CheckBoxHeight">22</system:Double>
<system:Double x:Key="CheckBoxWidth">22</system:Double>
<Thickness x:Key="DataGridCheckBoxPadding">11,5,11,6</Thickness>
<Thickness x:Key="DataGridCheckBoxBorderThemeThickness">1</Thickness>
<Thickness x:Key="DataGridCheckBoxContentMargin">8,0,0,0</Thickness>
<system:Double x:Key="DataGridCheckBoxIconSize">14</system:Double>
<system:Double x:Key="DataGridCheckBoxHeight">22</system:Double>
<system:Double x:Key="DataGridCheckBoxWidth">22</system:Double>

<Style x:Key="DataGridCheckBoxElementDefaultStyle" TargetType="{x:Type CheckBox}">
<!-- Universal WPF UI focus -->
Expand All @@ -641,8 +641,8 @@
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource CheckBoxBorderThemeThickness}" />
<Setter Property="Padding" Value="{StaticResource CheckBoxPadding}" />
<Setter Property="BorderThickness" Value="{StaticResource DataGridCheckBoxBorderThemeThickness}" />
<Setter Property="Padding" Value="{StaticResource DataGridCheckBoxPadding}" />
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
Expand All @@ -667,8 +667,8 @@
<BulletDecorator.Bullet>
<Border
x:Name="ControlBorderIconPresenter"
Width="{StaticResource CheckBoxHeight}"
Height="{StaticResource CheckBoxWidth}"
Width="{StaticResource DataGridCheckBoxHeight}"
Height="{StaticResource DataGridCheckBoxWidth}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
Expand All @@ -681,10 +681,10 @@
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{StaticResource CheckBoxIconSize}"
FontSize="{StaticResource DataGridCheckBoxIconSize}"
FontWeight="Bold"
FontFamily="{DynamicResource SegoeFluentIcons}"
Text="{StaticResource CheckBoxCheckedGlyph}"
Text="{StaticResource DataGridCheckBoxCheckedGlyph}"
Visibility="Collapsed">
<TextBlock.Foreground>
<SolidColorBrush Color="{DynamicResource TextOnAccentFillColorPrimary}" />
Expand All @@ -695,7 +695,7 @@
</BulletDecorator.Bullet>
<ContentPresenter
x:Name="ContentPresenter"
Margin="{StaticResource CheckBoxContentMargin}"
Margin="{StaticResource DataGridCheckBoxContentMargin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True" />
Expand All @@ -708,7 +708,7 @@
<Setter TargetName="ContentPresenter" Property="Margin" Value="0" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
<Setter TargetName="ControlIcon" Property="Text" Value="{StaticResource CheckBoxIndeterminateGlyph}" />
<Setter TargetName="ControlIcon" Property="Text" Value="{StaticResource DataGridCheckBoxIndeterminateGlyph}" />
<Setter TargetName="ControlIcon" Property="Visibility" Value="Visible" />
<Setter TargetName="ControlBorderIconPresenter" Property="Background">
<Setter.Value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<sys:Double x:Key="LineButtonHeight">12</sys:Double>
<sys:Double x:Key="LineButtonWidth">12</sys:Double>

<system:String x:Key="CaretUpGlyph">&#xEDDB;</system:String>
<system:String x:Key="CaretDownGlyph">&#xEDDC;</system:String>
<system:String x:Key="CaretLeftGlyph">&#xEDD9;</system:String>
<system:String x:Key="CaretRightGlyph">&#xEDDA;</system:String>
<system:String x:Key="ScrollBarCaretUpGlyph">&#xEDDB;</system:String>
<system:String x:Key="ScrollBarCaretDownGlyph">&#xEDDC;</system:String>
<system:String x:Key="ScrollBarCaretLeftGlyph">&#xEDD9;</system:String>
<system:String x:Key="ScrollBarCaretRightGlyph">&#xEDDA;</system:String>

<Style x:Key="ScrollBarLineButtonStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="Foreground" Value="{DynamicResource ScrollBarButtonArrowForeground}" />
Expand Down Expand Up @@ -137,7 +137,7 @@
Grid.Row="0"
HorizontalContentAlignment="Left"
Command="ScrollBar.LineUpCommand"
Content="{StaticResource CaretUpGlyph}"
Content="{StaticResource ScrollBarCaretUpGlyph}"
Opacity="0"
AutomationProperties.Name="Scroll Up"
Style="{StaticResource ScrollBarLineButtonStyle}" />
Expand Down Expand Up @@ -167,7 +167,7 @@
Grid.Row="2"
HorizontalContentAlignment="Left"
Command="ScrollBar.LineDownCommand"
Content="{StaticResource CaretDownGlyph}"
Content="{StaticResource ScrollBarCaretDownGlyph}"
Opacity="0"
AutomationProperties.Name="Scroll Down"
Style="{StaticResource ScrollBarLineButtonStyle}" />
Expand Down Expand Up @@ -259,7 +259,7 @@
Grid.Column="0"
VerticalAlignment="Center"
Command="ScrollBar.LineLeftCommand"
Content="{StaticResource CaretLeftGlyph}"
Content="{StaticResource ScrollBarCaretLeftGlyph}"
Opacity="0"
AutomationProperties.Name="Scroll Left"
Style="{StaticResource ScrollBarLineButtonStyle}" />
Expand Down Expand Up @@ -287,7 +287,7 @@
Grid.Column="2"
VerticalAlignment="Center"
Command="ScrollBar.LineRightCommand"
Content="{StaticResource CaretRightGlyph}"
Content="{StaticResource ScrollBarCaretRightGlyph}"
Opacity="0"
AutomationProperties.Name="Scroll Right"
Style="{StaticResource ScrollBarLineButtonStyle}" />
Expand Down
Loading
Loading