|
1 | | -using System; |
| 1 | +using MetroFramework; |
| 2 | +using System; |
2 | 3 | using System.Diagnostics; |
3 | 4 | using System.Runtime.InteropServices; |
4 | 5 | using System.Windows.Forms; |
5 | 6 |
|
6 | 7 | namespace Taskplay |
7 | 8 | { |
| 9 | + public struct ThemeSettings |
| 10 | + { |
| 11 | + public bool systemDarkMode; |
| 12 | + } |
| 13 | + |
8 | 14 | public partial class SettingsForm : Form |
9 | 15 | { |
10 | 16 | Microsoft.Win32.RegistryKey autorun; |
@@ -37,9 +43,18 @@ public SettingsForm(bool isDarkModeOn, bool showNextButton, bool showPrevButton, |
37 | 43 | this.syncInterval = syncInterval; |
38 | 44 | this.waitAfterClickSync = waitAfterClickSync; |
39 | 45 | this.showSongChangeButtonsWhilePaused = showSongChangeButtonsWhilePaused; |
40 | | - |
41 | | - |
42 | | - |
| 46 | + //get system accent color using winUISettings |
| 47 | + var uiSettings = new Windows.UI.ViewManagement.UISettings(); |
| 48 | + var accentColor = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Accent); |
| 49 | + //Figure out for later |
| 50 | + if (Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1).ToString() == "0") |
| 51 | + { |
| 52 | + metroStyleManager1.Style = MetroFramework.MetroColorStyle.White; |
| 53 | + } |
| 54 | + else |
| 55 | + { |
| 56 | + metroStyleManager1.Style = MetroFramework.MetroColorStyle.Black; |
| 57 | + } |
43 | 58 | } |
44 | 59 |
|
45 | 60 | private void SettingsForm_Load(object sender, EventArgs e) |
@@ -130,6 +145,7 @@ protected override void OnHandleCreated(EventArgs e) |
130 | 145 | { |
131 | 146 | if (Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1).ToString() == "0") |
132 | 147 | { |
| 148 | + |
133 | 149 | if (DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0) |
134 | 150 | DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); |
135 | 151 | } |
|
0 commit comments