Files

85 lines
3.5 KiB
C#
Raw Permalink Normal View History

#nullable enable
using System.Windows;
using System.Windows.Media;
namespace ReminderOrganizer.Core
{
/// <summary>
/// One place for the light/dark palette. Neutral greys + a single muted accent (Fluent-like).
/// Applied to Application.Resources so context menus, tooltips and dialogs all follow the theme.
/// </summary>
public static class Theme
{
public static bool IsDark { get; private set; } = true;
private static SolidColorBrush B(uint rgb, byte alpha = 255)
{
var b = new SolidColorBrush(Color.FromArgb(alpha, (byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb));
b.Freeze();
return b;
}
public static void Apply(ResourceDictionary res, bool dark)
{
if (ReferenceEquals(res, Application.Current?.Resources)) IsDark = dark;
// shared
res["PrimaryBrush"] = B(0x5B5BD6);
res["PrimaryHoverBrush"] = B(0x4C4CC4);
res["DangerBrush"] = B(dark ? 0xF0706AU : 0xD93A34U);
res["WarningBrush"] = B(0xE5A00D);
res["SuccessBrush"] = B(dark ? 0x3DD68CU : 0x18A058U);
res["SecondaryBrush"] = res["SuccessBrush"];
if (dark)
{
res["BackgroundBrush"] = B(0x16161A);
res["SidebarBrush"] = B(0x1C1C21);
res["HeaderBrush"] = B(0x1C1C21);
res["CardBrush"] = B(0x202026);
res["MenuBackgroundBrush"] = B(0x26262D);
res["InputBackgroundBrush"] = B(0x1A1A1F);
res["BorderBrush"] = B(0x2E2E36);
res["DividerBrush"] = B(0x2A2A31);
res["HoverBrush"] = B(0x2A2A31);
res["SelectedBrush"] = B(0x2B2B45);
res["TextPrimaryBrush"] = B(0xEDEDF2);
res["TextSecondaryBrush"] = B(0x9C9CA8);
res["TextTertiaryBrush"] = B(0x6E6E7A);
res["SidebarTextBrush"] = B(0xDCDCE4);
res["SidebarSecondaryBrush"] = B(0x80808C);
res["AccentSubtleBrush"] = B(0x2D2D4C);
res["AccentTextBrush"] = B(0xB9BAFF);
res["PrimaryLightBrush"] = res["AccentSubtleBrush"];
res["BadgeBrush"] = B(0x2D2D4C);
res["BadgeTextBrush"] = B(0xB9BAFF);
res["SnackbarBrush"] = B(0x33333C);
}
else
{
res["BackgroundBrush"] = B(0xF6F7F9);
res["SidebarBrush"] = B(0xEEF0F3);
res["HeaderBrush"] = B(0xEEF0F3);
res["CardBrush"] = B(0xFFFFFF);
res["MenuBackgroundBrush"] = B(0xFFFFFF);
res["InputBackgroundBrush"] = B(0xFFFFFF);
res["BorderBrush"] = B(0xDDE0E6);
res["DividerBrush"] = B(0xECEEF2);
res["HoverBrush"] = B(0xE6E8EE);
res["SelectedBrush"] = B(0xE9E9FB);
res["TextPrimaryBrush"] = B(0x1B1D23);
res["TextSecondaryBrush"] = B(0x646A78);
res["TextTertiaryBrush"] = B(0x9AA0AC);
res["SidebarTextBrush"] = B(0x2A2D35);
res["SidebarSecondaryBrush"] = B(0x7A7F8C);
res["AccentSubtleBrush"] = B(0xE4E4FA);
res["AccentTextBrush"] = B(0x3F3FB5);
res["PrimaryLightBrush"] = res["AccentSubtleBrush"];
res["BadgeBrush"] = B(0xE8E8FB);
res["BadgeTextBrush"] = B(0x4343B8);
res["SnackbarBrush"] = B(0x2B2D35);
}
}
}
}