PM-3349 Fixed white tint color not appearing on images added as MAU IImage SVG
PM-3349 PM-3350 Fix for Avatar text not adjusting to white/black color correctly
This commit is contained in:
parent
e7aeb08cae
commit
aaf082faba
|
@ -219,10 +219,10 @@
|
|||
<MauiImage Include="Resources\more.svg">
|
||||
<BaseSize>24,24</BaseSize>
|
||||
</MauiImage>
|
||||
<MauiImage Include="Resources\plus.svg">
|
||||
<MauiImage Include="Resources\plus.svg" TintColor="#FFFFFFFF">
|
||||
<BaseSize>24,24</BaseSize>
|
||||
</MauiImage>
|
||||
<MauiImage Include="Resources\search.svg">
|
||||
<MauiImage Include="Resources\search.svg" TintColor="#FFFFFFFF">
|
||||
<BaseSize>24,24</BaseSize>
|
||||
</MauiImage>
|
||||
<MauiImage Include="Resources\send.svg">
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue