mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-31 23:08:23 -04:00
[GUI] Add dark theme (#388)
This commit is contained in:
parent
08442f21b7
commit
19f678ca01
9 changed files with 147 additions and 110 deletions
42
DiscordChatExporter.Gui/Theme.cs
Normal file
42
DiscordChatExporter.Gui/Theme.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using MaterialDesignThemes.Wpf;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DiscordChatExporter.Gui
|
||||
{
|
||||
public sealed class Theme
|
||||
{
|
||||
public static Theme Light { get; } = new Theme(new MaterialDesignLightTheme(), HexToColor.Convert("#343838"), HexToColor.Convert("#F9A825"));
|
||||
public static Theme Dark { get; } = new Theme(new MaterialDesignDarkTheme(), HexToColor.Convert("#E8E8E8"), HexToColor.Convert("#F9A825"));
|
||||
|
||||
public static void SetCurrent(Theme theme)
|
||||
{
|
||||
var paletteHelper = new PaletteHelper();
|
||||
|
||||
var materialTheme = paletteHelper.GetTheme();
|
||||
materialTheme.SetBaseTheme(theme.BaseTheme);
|
||||
materialTheme.SetPrimaryColor(theme.PrimaryColor);
|
||||
materialTheme.SetSecondaryColor(theme.SecondaryColor);
|
||||
|
||||
paletteHelper.SetTheme(materialTheme);
|
||||
}
|
||||
|
||||
public Theme(IBaseTheme baseTheme, Color primaryColor, Color secondaryColor)
|
||||
{
|
||||
BaseTheme = baseTheme;
|
||||
PrimaryColor = primaryColor;
|
||||
SecondaryColor = secondaryColor;
|
||||
}
|
||||
|
||||
public IBaseTheme BaseTheme { get; }
|
||||
public Color PrimaryColor { get; }
|
||||
public Color SecondaryColor { get; }
|
||||
|
||||
class HexToColor
|
||||
{
|
||||
public static Color Convert(string hex)
|
||||
{
|
||||
return (Color)ColorConverter.ConvertFromString(hex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue