Skip to content

Commit 7cabea1

Browse files
committed
Invariant percentage in color conversion
1 parent ea6ce57 commit 7cabea1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CommunityToolkit.Maui.Core/Extensions/ColorConversionExtensions.shared.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public static class ColorConversionExtensions
1616
/// <returns></returns>
1717
static string ToPercentage(this float percentage)
1818
{
19-
return Math.Round(percentage, 2, MidpointRounding.ToEven).ToString("0%");
19+
var toEvenRounded = Math.Round(percentage, 2, MidpointRounding.ToEven);
20+
return FormattableString.Invariant($"{toEvenRounded:0%}");
2021
}
2122

2223
/// <summary>

0 commit comments

Comments
 (0)