-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThemeService.cs
More file actions
30 lines (27 loc) · 778 Bytes
/
Copy pathThemeService.cs
File metadata and controls
30 lines (27 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using ControlzEx.Theming;
using System.Windows;
using System.Windows.Media;
namespace RouteEditorCS
{
/// <summary>
/// A helper class to handle different UI themes comming from MahApps.
/// </summary>
class ThemeService
{
private Color _color;
public ThemeService (byte red, byte green, byte blue)
{
_color = Color.FromRgb(red, green, blue);
}
public void ApplyTheme (FrameworkElement frameworkElement, Boolean isDark)
{
ThemeManager.Current.ChangeTheme(
frameworkElement,
RuntimeThemeGenerator.Current.GenerateRuntimeTheme(
isDark ? "Dark" : "Light",
_color
)
);
}
}
}