You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.3 KiB
84 lines
2.3 KiB
using System.Drawing;
|
|
|
|
namespace BlazorLottoPicker.Utilities
|
|
{
|
|
public class Utils
|
|
{
|
|
// 노 파 빨 회 초
|
|
public static Color[] Palettes = new Color[]
|
|
{
|
|
Color.FromArgb(245, 233, 77),
|
|
Color.FromArgb(15, 76, 129),
|
|
Color.FromArgb(191, 25, 50),
|
|
Color.FromArgb(147, 149, 151),
|
|
Color.FromArgb(0, 148, 115),
|
|
};
|
|
|
|
public static List<string> HexColorPallets = new List<string>()
|
|
{
|
|
HexConverter(Color.FromArgb(245, 233, 77)),
|
|
HexConverter(Color.FromArgb(15, 76, 129)),
|
|
HexConverter(Color.FromArgb(191, 25, 50)),
|
|
HexConverter(Color.FromArgb(147, 149, 151)),
|
|
HexConverter(Color.FromArgb(0, 148, 115)),
|
|
};
|
|
|
|
public static List<string> ColorPallets = new List<string>()
|
|
{
|
|
"Yellow",
|
|
"Blue",
|
|
"Red",
|
|
"Gray",
|
|
"Green",
|
|
};
|
|
|
|
private static int _callCount = 1;
|
|
// 1-10, 11-20, 21-30, 31-40, 41-45
|
|
public static int GetNumber(int index)
|
|
{
|
|
if (_callCount > int.MaxValue / 2)
|
|
_callCount = 1;
|
|
|
|
int min = 1;
|
|
int max = 46;
|
|
switch (index)
|
|
{
|
|
case 0:
|
|
min = 1;
|
|
max = 11;
|
|
break;
|
|
case 1:
|
|
min = 11;
|
|
max = 21;
|
|
break;
|
|
case 2:
|
|
min = 21;
|
|
max = 31;
|
|
break;
|
|
case 3:
|
|
min = 31;
|
|
max = 41;
|
|
break;
|
|
case 4:
|
|
min = 41;
|
|
max = 46;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
Random rand = new Random(unchecked((int)DateTime.Now.Ticks) + _callCount);
|
|
return rand.Next(min, max);
|
|
}
|
|
|
|
public static String HexConverter(Color c)
|
|
{
|
|
return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
|
|
}
|
|
|
|
public static String RGBConverter(Color c)
|
|
{
|
|
return "RGB(" + c.R.ToString() + "," + c.G.ToString() + "," + c.B.ToString() + ")";
|
|
}
|
|
}
|
|
}
|
|
|