diff --git a/src/App/App.csproj b/src/App/App.csproj
index a33e55f327..eb7b3724d1 100644
--- a/src/App/App.csproj
+++ b/src/App/App.csproj
@@ -219,10 +219,10 @@
24,24
-
+
24,24
-
+
24,24
diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs
index cd8f37f8db..95ba708c2c 100644
--- a/src/Core/Utilities/CoreHelpers.cs
+++ b/src/Core/Utilities/CoreHelpers.cs
@@ -267,13 +267,16 @@ namespace Bit.Core.Utilities
public static string TextColorFromBgColor(string hexColor, int threshold = 166)
{
- if (new ColorConverter().ConvertFromString(hexColor) is Color bgColor)
+ var isValidColor = Color.TryParse(hexColor, out var bgColor);
+ if (isValidColor)
{
- var luminance = bgColor.Red * 0.299 + bgColor.Green * 0.587 + bgColor.Blue * 0.114;
+ var luminance = (bgColor.Red * 255 * 0.299) + (bgColor.Green * 255 * 0.587) + (bgColor.Blue * 255 * 0.114);
return luminance > threshold ? "#ff000000" : "#ffffffff";
}
-
- return "#ff000000";
+ else
+ {
+ return "#ff000000";
+ }
}
public static string StringToColor(string str, string fallback)