category management
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace Billing
|
||||
@@ -53,5 +54,24 @@ namespace Billing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public const string DEFAULT_COLOR = "#183153";
|
||||
|
||||
public static string WrapColorString(string color)
|
||||
{
|
||||
if (color == null)
|
||||
{
|
||||
return DEFAULT_COLOR;
|
||||
}
|
||||
if (color.Length > 7)
|
||||
{
|
||||
var alpha = color[1..3];
|
||||
if (int.TryParse(alpha, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out int a) && a == 255)
|
||||
{
|
||||
return "#" + color[3..];
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user