diff --git a/src/SwitchifyPc.App/App.xaml b/src/SwitchifyPc.App/App.xaml
index a3307d5..f8b4886 100644
--- a/src/SwitchifyPc.App/App.xaml
+++ b/src/SwitchifyPc.App/App.xaml
@@ -2,5 +2,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+
+
+
+
diff --git a/src/SwitchifyPc.App/App.xaml.cs b/src/SwitchifyPc.App/App.xaml.cs
index 22c1559..003aff7 100644
--- a/src/SwitchifyPc.App/App.xaml.cs
+++ b/src/SwitchifyPc.App/App.xaml.cs
@@ -14,6 +14,7 @@
using SwitchifyPc.Core.Startup;
using SwitchifyPc.Core.Ui;
using SwitchifyPc.Core.Updates;
+using SwitchifyPc.App.Themes;
using SwitchifyPc.Windows.AppLifecycle;
using SwitchifyPc.Windows.Bluetooth;
using SwitchifyPc.Windows.CursorOverlay;
@@ -44,6 +45,7 @@ public partial class App : System.Windows.Application
private MouseRepeatController? mouseRepeatController;
private WindowsCursorOverlayNotifier? cursorOverlay;
private DispatcherTimer? pairingExpiryTimer;
+ private AppThemeManager? themeManager;
private bool isQuitting;
protected override void OnStartup(StartupEventArgs e)
@@ -75,6 +77,8 @@ protected override void OnStartup(StartupEventArgs e)
existingInstanceSignal.Start(
() => Dispatcher.BeginInvoke(ShowMainWindow),
() => Dispatcher.BeginInvoke(QuitApplication));
+ themeManager = AppThemeManager.ForCurrentApplication(new WindowsAppThemeProvider());
+ themeManager.Start();
updateService = CreateUpdateService();
pairingApprovalManager = CreatePairingApprovalManager();
bluetoothStatusTracker = new BluetoothStatusTracker(onStatusChanged: UpdateBluetoothState);
@@ -113,6 +117,8 @@ protected override void OnExit(ExitEventArgs e)
bluetoothServer = null;
cursorOverlay?.Dispose();
cursorOverlay = null;
+ themeManager?.Dispose();
+ themeManager = null;
commandExecutor = null;
bluetoothFrameProcessor = null;
bluetoothStatusTracker = null;
diff --git a/src/SwitchifyPc.App/Chrome/SwitchifyTitleBar.xaml b/src/SwitchifyPc.App/Chrome/SwitchifyTitleBar.xaml
index c1e9948..605dc3d 100644
--- a/src/SwitchifyPc.App/Chrome/SwitchifyTitleBar.xaml
+++ b/src/SwitchifyPc.App/Chrome/SwitchifyTitleBar.xaml
@@ -3,8 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
Height="44"
- Background="#D32F2F"
- Foreground="White"
+ Background="{DynamicResource ChromeBackground}"
+ Foreground="{DynamicResource ChromeForeground}"
shell:WindowChrome.IsHitTestVisibleInChrome="True"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
@@ -16,7 +16,7 @@
-
+
@@ -31,10 +31,10 @@
-
+
-
+
@@ -56,10 +56,10 @@
-
+
-
+
@@ -90,7 +90,7 @@
TextTrimming="CharacterEllipsis"
FontSize="13"
FontWeight="SemiBold"
- Foreground="White" />
+ Foreground="{DynamicResource ChromeForeground}" />
@@ -29,26 +29,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -188,31 +175,31 @@
-
+
@@ -234,9 +221,9 @@
TitleText="Switchify PC"
ShowMinimizeButton="True" />
-
+
+ Background="{DynamicResource AppBackground}" />
@@ -281,7 +268,7 @@
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{Binding StatusBadgeLabel}"
- Foreground="{StaticResource Text}"
+ Foreground="{DynamicResource Text}"
FontSize="12"
FontWeight="SemiBold" />
@@ -294,7 +281,7 @@
@@ -313,7 +300,7 @@
@@ -328,7 +315,7 @@
+ Foreground="{DynamicResource Text}" />
@@ -378,8 +365,8 @@
+ Foreground="{DynamicResource Text}" />
@@ -415,8 +402,8 @@
+ Foreground="{DynamicResource OnAccentContainer}" />
+ Background="{DynamicResource Surface}">
@@ -445,10 +432,10 @@
+ Foreground="{DynamicResource Text}" />
@@ -476,7 +463,7 @@
diff --git a/src/SwitchifyPc.App/SettingsWindow.xaml b/src/SwitchifyPc.App/SettingsWindow.xaml
index c6e586d..1599a7b 100644
--- a/src/SwitchifyPc.App/SettingsWindow.xaml
+++ b/src/SwitchifyPc.App/SettingsWindow.xaml
@@ -15,7 +15,7 @@
ResizeMode="NoResize"
Icon="Assets/icon.ico"
FontFamily="Segoe UI"
- Background="#D32F2F"
+ Background="{DynamicResource ChromeBackground}"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
d:DataContext="{d:DesignInstance Type=ui:SettingsViewModel, IsDesignTimeCreatable=True}">
@@ -30,21 +30,13 @@
-
-
-
-
-
-
-
-
@@ -163,7 +155,7 @@
-
+
@@ -180,12 +172,12 @@
-
+
-
-
-
+
+
+
@@ -197,10 +189,10 @@
-
-
+
+
-
+
@@ -219,12 +211,12 @@
-
+
-
-
-
+
+
+
@@ -241,12 +233,12 @@
-
-
+
+
-
+
@@ -260,16 +252,16 @@
+ Background="{DynamicResource AppBackground}" />
+ Foreground="{DynamicResource ChromeForeground}" />
@@ -280,8 +272,8 @@
-
+ Foreground="{DynamicResource Text}" />
@@ -677,7 +669,7 @@
Checked="CursorOverlayColorWhite_Checked"
Style="{StaticResource SegmentRadio}">
-
+
diff --git a/src/SwitchifyPc.App/Themes/AppTheme.cs b/src/SwitchifyPc.App/Themes/AppTheme.cs
new file mode 100644
index 0000000..2fb9b77
--- /dev/null
+++ b/src/SwitchifyPc.App/Themes/AppTheme.cs
@@ -0,0 +1,158 @@
+using System.Windows;
+using System.Windows.Threading;
+using System.IO.Packaging;
+using Microsoft.Win32;
+using WpfApplication = System.Windows.Application;
+
+namespace SwitchifyPc.App.Themes;
+
+public enum AppTheme
+{
+ Light,
+ Dark
+}
+
+public interface IAppThemeProvider
+{
+ AppTheme GetCurrentTheme();
+}
+
+public sealed class WindowsAppThemeProvider : IAppThemeProvider
+{
+ private const string PersonalizeRegistryPath = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
+ private const string AppsUseLightThemeValueName = "AppsUseLightTheme";
+ private readonly Func