Skip to content

Commit

Permalink
Taskbar Color should be considered for the taskbar icon #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Knobloch Christian committed Nov 4, 2020
1 parent 348b023 commit dc20fc3
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 7 deletions.
3 changes: 3 additions & 0 deletions BlinkStickBusylightClient/BlinkStickBusylightClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,8 @@
<Resource Include="Resources\favicon.ico" />
<Resource Include="Resources\trayicon.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\trayiconBlack.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
9 changes: 8 additions & 1 deletion BlinkStickBusylightClient/NotifyIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ class NotifyIcon
public NotifyIcon()
{
notifyIcon = new System.Windows.Forms.NotifyIcon();
notifyIcon.Icon = Properties.Resources.trayicon;

// what tryicon should be used?
bool systemUsesLightTheme = WPF.ColorManager.SystemUsesLightTheme();
if (systemUsesLightTheme)
notifyIcon.Icon = Properties.Resources.trayiconBlack;
else
notifyIcon.Icon = Properties.Resources.trayicon;

notifyIcon.Visible = true;
notifyIcon.DoubleClick += new EventHandler(notifyIconDoubleClick);

Expand Down
4 changes: 2 additions & 2 deletions BlinkStickBusylightClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]
[assembly: AssemblyVersion("1.0.2.1")]
[assembly: AssemblyFileVersion("1.0.2.1")]
10 changes: 10 additions & 0 deletions BlinkStickBusylightClient/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions BlinkStickBusylightClient/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@
<data name="trayicon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trayicon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trayiconBlack" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trayiconBlack.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.
16 changes: 16 additions & 0 deletions BlinkStickBusylightClient/WPF/ColorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ public static Color PrimaryTextColor
get { return GetPrimaryTextColor(); }
}

public static bool SystemUsesLightTheme()
{
bool isLightMode = true;
try
{
var v = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "SystemUsesLightTheme", "1");
if (v != null && v.ToString() == "0")
isLightMode = false;
}
catch
{
}

return isLightMode;
}

private static Color GetAccentColor()
{
if (EnvironmentUtils.IsWindowsVersion8OrHigher())
Expand Down
8 changes: 4 additions & 4 deletions BlinkStickBusylightClient/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BlinkStickDotNet" version="2.0.16" targetFramework="net461" />
<package id="Extended.Wpf.Toolkit" version="3.3.0" targetFramework="net461" />
<package id="HidSharp" version="1.5" targetFramework="net461" />
<package id="LibUsbDotNet" version="2.2.8" targetFramework="net461" />
<package id="BlinkStickDotNet" version="2.0.16" targetFramework="net46" />
<package id="Extended.Wpf.Toolkit" version="3.3.0" targetFramework="net46" />
<package id="HidSharp" version="1.5" targetFramework="net46" />
<package id="LibUsbDotNet" version="2.2.8" targetFramework="net46" />
</packages>

0 comments on commit dc20fc3

Please sign in to comment.