Skip to content
Open
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
43 changes: 25 additions & 18 deletions src/Forge.Application.Demo/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,41 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />

<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Red.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />

<!-- Material Design: MahApps Compatibility -->
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Flyout.xaml" />

<!-- Route View Bindings -->
<ResourceDictionary Source="ViewBindings.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- MahApps Brushes -->
<SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}" />
<SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}" />
<SolidColorBrush x:Key="AccentColorBrush2" Color="{DynamicResource Primary400}" />
<SolidColorBrush x:Key="AccentColorBrush3" Color="{DynamicResource Primary300}" />
<SolidColorBrush x:Key="AccentColorBrush4" Color="{DynamicResource Primary200}" />
<SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource Primary700}" />
<SolidColorBrush x:Key="AccentSelectedColorBrush" Color="{DynamicResource Primary500Foreground}" />
<LinearGradientBrush x:Key="ProgressBrush" StartPoint="1.002,0.5" EndPoint="0.001,0.5">
<GradientStop Offset="0" Color="{DynamicResource Primary700}" />
<GradientStop Offset="1" Color="{DynamicResource Primary300}" />

<!-- MahApps Brushes -->
<SolidColorBrush x:Key="MahApps.Brushes.Highlight" Color="{DynamicResource Primary700}"/>
<SolidColorBrush x:Key="MahApps.Brushes.AccentBase" Color="{DynamicResource Primary600}" />
<SolidColorBrush x:Key="MahApps.Brushes.Accent" Color="{DynamicResource Primary500}"/>
<SolidColorBrush x:Key="MahApps.Brushes.Accent2" Color="{DynamicResource Primary400}"/>
<SolidColorBrush x:Key="MahApps.Brushes.Accent3" Color="{DynamicResource Primary300}"/>
<SolidColorBrush x:Key="MahApps.Brushes.Accent4" Color="{DynamicResource Primary200}"/>
<SolidColorBrush x:Key="MahApps.Brushes.WindowTitle" Color="{DynamicResource Primary700}"/>
<SolidColorBrush x:Key="MahApps.Brushes.Selected.Foreground" Color="{DynamicResource Primary500Foreground}"/>
<LinearGradientBrush x:Key="MahApps.Brushes.Progress" EndPoint="0.001,0.5" StartPoint="1.002,0.5">
<GradientStop Color="{DynamicResource Primary700}" Offset="0"/>
<GradientStop Color="{DynamicResource Primary300}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="CheckmarkFill" Color="{DynamicResource Primary500}" />
<SolidColorBrush x:Key="RightArrowFill" Color="{DynamicResource Primary500}" />
<SolidColorBrush x:Key="IdealForegroundColorBrush" Color="{DynamicResource Primary500Foreground}" />
<SolidColorBrush x:Key="IdealForegroundDisabledBrush"
Opacity="0.4"
Color="{DynamicResource Primary500}" />
<SolidColorBrush x:Key="MahApps.Brushes.CheckmarkFill" Color="{DynamicResource Primary500}"/>
<SolidColorBrush x:Key="MahApps.Brushes.RightArrowFill" Color="{DynamicResource Primary500}"/>
<SolidColorBrush x:Key="MahApps.Brushes.IdealForeground" Color="{DynamicResource Primary500Foreground}"/>
<SolidColorBrush x:Key="MahApps.Brushes.IdealForegroundDisabled" Color="{DynamicResource Primary500}" Opacity="0.4"/>
<SolidColorBrush x:Key="MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchBrush.Win10" Color="{DynamicResource Primary500}" />
<SolidColorBrush x:Key="MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchMouseOverBrush.Win10" Color="{DynamicResource Primary400}" />
<SolidColorBrush x:Key="MahApps.Metro.Brushes.ToggleSwitchButton.ThumbIndicatorCheckedBrush.Win10" Color="{DynamicResource Primary500Foreground}" />
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 9 additions & 3 deletions src/Forge.Application.Demo/Forge.Application.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="1.6.5" />
<PackageReference Include="MaterialDesignColors" Version="1.1.3" />
<PackageReference Include="MaterialDesignThemes" Version="2.5.0.1205" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
<PackageReference Include="MaterialDesignColors" Version="2.0.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.1.0" />
<PackageReference Include="MaterialDesignThemes.MahApps">
<Version>0.1.7</Version>
</PackageReference>
<PackageReference Include="MaterialDesignThemes.Wpf">
<Version>1.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/Forge.Application.Demo/Views/AboutView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
VerticalAlignment="Stretch">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="24,24,16,16">
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Text="About this app" />
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="About this app" />
<TextBlock
Margin="0,24,0,0"
Text="This is a description page about this application."
Expand Down
2 changes: 1 addition & 1 deletion src/Forge.Application.Demo/Views/ContactView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
VerticalAlignment="Center">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="24,24,16,16">
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" Text="Send e-mail" />
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="Send e-mail" />
<TextBlock Margin="0,16,0,0" Text="Your name" />
<TextBox Text="{Binding Name}" />
<TextBlock Margin="0,16,0,0" Text="Your message" />
Expand Down
1 change: 0 additions & 1 deletion src/Forge.Application/Controls/MaterialRoutesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
IsDesignTimeCreatable=False}"
internal:AttachedProperties.InputBindingsSource="{Binding Routes.Current.RouteConfig.KeyBindings}"
Background="{DynamicResource MaterialDesignPaper}"
EnableDWMDropShadow="True"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
TextElement.FontSize="{Binding FontSize,
Mode=OneWay}"
Expand Down
8 changes: 4 additions & 4 deletions src/Forge.Application/Forge.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<None Remove="Controls\MaterialRoutesWindow.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="1.6.5" />
<PackageReference Include="MaterialDesignColors" Version="1.1.3" />
<PackageReference Include="MaterialDesignThemes" Version="2.5.0.1205" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
<PackageReference Include="MaterialDesignColors" Version="2.0.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.1.0" />
<PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>4.9.2</Version>
<Version>5.10.0</Version>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
18 changes: 13 additions & 5 deletions src/Forge.Application/Infrastructure/Internal/PaletteService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Forge.Application.Infrastructure.Internal
{
using System.Windows.Media;
using MaterialDesignThemes.Wpf;

internal class PaletteService : IPaletteService
Expand All @@ -16,36 +17,43 @@ internal class PaletteService : IPaletteService

public void RefreshTheme()
{
new PaletteHelper().SetLightDark(this.DarkMode);
var paletteHelper = new PaletteHelper();
var theme = paletteHelper.GetTheme();
IBaseTheme baseTheme = DarkMode ? new MaterialDesignDarkTheme() : (IBaseTheme)new MaterialDesignLightTheme();
theme.SetBaseTheme(baseTheme);
paletteHelper.SetTheme(theme);
}

public void RefreshPalette()
{
var paletteHelper = new PaletteHelper();
var theme = paletteHelper.GetTheme();
if (this.DarkMode)
{
if (this.DarkModePrimary != null)
{
paletteHelper.ReplacePrimaryColor(this.DarkModePrimary);
theme.SetPrimaryColor((Color)ColorConverter.ConvertFromString(this.DarkModePrimary));
}

if (this.DarkModeAccent != null)
{
paletteHelper.ReplaceAccentColor(this.DarkModeAccent);
theme.SetSecondaryColor((Color)ColorConverter.ConvertFromString(this.DarkModeAccent));
}
}
else
{
if (this.LightModePrimary != null)
{
paletteHelper.ReplacePrimaryColor(this.LightModePrimary);
theme.SetPrimaryColor((Color)ColorConverter.ConvertFromString(this.LightModePrimary));
}

if (this.LightModeAccent != null)
{
paletteHelper.ReplaceAccentColor(this.LightModeAccent);
theme.SetSecondaryColor((Color)ColorConverter.ConvertFromString(this.LightModeAccent));
}
}

paletteHelper.SetTheme(theme);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<PackageReference Include="Forge.Application">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="MahApps.Metro" Version="1.6.5" />
<PackageReference Include="MaterialDesignColors" Version="1.1.3" />
<PackageReference Include="MaterialDesignThemes" Version="2.5.0.1205" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
<PackageReference Include="MaterialDesignColors" Version="2.0.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down