Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 7c4aa33

Browse files
authored
Merge pull request #7 from fuyufjh/master
switch the logo color according to system theme
2 parents 0404ffb + 15716fe commit 7c4aa33

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/Light Switch/Light Switch/Services/ThemeService.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ public void Reload()
4343

4444
private void SetLight()
4545
{
46-
NotifyIcon.Icon = Resources.Icon_LightMode;
47-
4846
var preferences = PreferencesService.GetPreferences();
4947

5048
if (preferences.IsAppThemeEnabled) SetAppTheme(true);
51-
if (preferences.IsSystemThemeEnabled) SetSystemTheme(true);
49+
if (preferences.IsSystemThemeEnabled)
50+
{
51+
SetSystemTheme(true);
52+
NotifyIcon.Icon = Resources.Icon_LightMode;
53+
}
5254
if (preferences.IsWallpaperEnabled)
5355
{
5456
if (File.Exists(preferences.LightWallpaperPath))
@@ -66,12 +68,14 @@ private void SetLight()
6668

6769
private void SetDark()
6870
{
69-
NotifyIcon.Icon = Resources.Icon_DarkMode;
70-
7171
var preferences = PreferencesService.GetPreferences();
7272

7373
if (preferences.IsAppThemeEnabled) SetAppTheme(false);
74-
if (preferences.IsSystemThemeEnabled) SetSystemTheme(false);
74+
if (preferences.IsSystemThemeEnabled)
75+
{
76+
SetSystemTheme(false);
77+
NotifyIcon.Icon = Resources.Icon_DarkMode;
78+
}
7579
if (preferences.IsWallpaperEnabled)
7680
{
7781
if (File.Exists(preferences.DarkWallpaperPath))

src/Light Switch/Light Switch/Storage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ public bool Equals(FileInfo x, FileInfo y)
9797
_ => null,
9898
};
9999

100-
public static readonly Storage Wallpapers = new(nameof(Wallpapers));
101-
102100
/// <summary>
103101
/// Path to LightSwitch storage in current user's temp folder.
104102
/// </summary>
105103
private static string BasePath { get; } = Path.Combine(Path.GetTempPath(), "LightSwitch");
106104

105+
public static readonly Storage Wallpapers = new(nameof(Wallpapers));
106+
107107
/// <summary>
108108
/// Generates a unique string from current date and time.
109109
/// </summary>

0 commit comments

Comments
 (0)