mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Use dark or light GitHub logo automatically depending on how dark is theme background color
This commit is contained in:
parent
4701eb7d0f
commit
251bbe2119
10 changed files with 518 additions and 535 deletions
|
@ -381,7 +381,12 @@ public static Color VisibleColor(Color color)
|
|||
|
||||
public static Color VisibleColor(Color color, Color lightColor, Color darkColor)
|
||||
{
|
||||
return PerceivedBrightness(color) > 130 ? darkColor : lightColor;
|
||||
return IsLightColor(color) ? darkColor : lightColor;
|
||||
}
|
||||
|
||||
public static bool IsLightColor(Color color)
|
||||
{
|
||||
return PerceivedBrightness(color) > 130;
|
||||
}
|
||||
|
||||
public static Color Lerp(Color from, Color to, float amount)
|
||||
|
|
2
ShareX/Forms/MainForm.Designer.cs
generated
2
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -2283,7 +2283,7 @@ private void InitializeComponent()
|
|||
// tsbGitHub
|
||||
//
|
||||
this.tsbGitHub.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.tsbGitHub.Image = global::ShareX.Properties.Resources.GitHub_32x32;
|
||||
this.tsbGitHub.Image = global::ShareX.Properties.Resources.GitHub_Black_32x32;
|
||||
resources.ApplyResources(this.tsbGitHub, "tsbGitHub");
|
||||
this.tsbGitHub.Name = "tsbGitHub";
|
||||
this.tsbGitHub.Click += new System.EventHandler(this.TsbGitHub_Click);
|
||||
|
|
|
@ -821,6 +821,15 @@ public void UpdateTheme()
|
|||
btnCloseNews.FlatAppearance.BorderColor = ShareXResources.Theme.BorderColor;
|
||||
btnCloseNews.ForeColor = ShareXResources.Theme.TextColor;
|
||||
btnCloseNews.BackColor = ShareXResources.Theme.LightBackgroundColor;
|
||||
|
||||
if (ColorHelpers.IsLightColor(ShareXResources.Theme.BackgroundColor))
|
||||
{
|
||||
tsbGitHub.Image = Resources.GitHub_Black_32x32;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsbGitHub.Image = Resources.GitHub_White_32x32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -842,6 +851,7 @@ public void UpdateTheme()
|
|||
btnCloseNews.FlatAppearance.BorderColor = SystemColors.ControlText;
|
||||
btnCloseNews.ForeColor = SystemColors.ControlText;
|
||||
btnCloseNews.BackColor = SystemColors.Window;
|
||||
tsbGitHub.Image = Resources.GitHub_Black_32x32;
|
||||
}
|
||||
|
||||
pbPreview.UpdateTheme();
|
||||
|
|
File diff suppressed because it is too large
Load diff
14
ShareX/Properties/Resources.Designer.cs
generated
14
ShareX/Properties/Resources.Designer.cs
generated
|
@ -1308,9 +1308,19 @@ public static System.Drawing.Bitmap GitHub {
|
|||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap GitHub_32x32 {
|
||||
public static System.Drawing.Bitmap GitHub_Black_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("GitHub_32x32", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("GitHub_Black_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap GitHub_White_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("GitHub_White_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1012,13 +1012,16 @@ Middle click to close</value>
|
|||
<data name="Discord_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Discord-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="GitHub_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GitHub-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Patreon_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Patreon-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Twitter_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Twitter-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="GitHub_Black_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GitHub-Black-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="GitHub_White_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GitHub-White-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
BIN
ShareX/Resources/GitHub-Black-32x32.png
Normal file
BIN
ShareX/Resources/GitHub-Black-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
ShareX/Resources/GitHub-White-32x32.png
Normal file
BIN
ShareX/Resources/GitHub-White-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -1677,7 +1677,10 @@
|
|||
<None Include="Resources\Bitcoin-32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\GitHub-32x32.png" />
|
||||
<None Include="Resources\GitHub-White-32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\GitHub-Black-32x32.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
|
Loading…
Reference in a new issue