@using BlazorLottoPicker.Utilities;
@code {
List _colorPallets = Utils.ColorPallets;
string _selectedColor = Utils.ColorPallets[0];
int _selectedIndex = 0;
int _value = 0;
string SelectedHexColor
{
get
{
_selectedIndex = _colorPallets.IndexOf(_selectedColor);
_value = Pick(_selectedIndex);
return Utils.HexColorPallets[_selectedIndex];
}
}
int Pick(int index)
{
return Utils.GetNumber(index);
}
void Shuffle()
{
_selectedColor = Utils.ColorPallets[new Random().Next(_value, Utils.ColorPallets.Count)];
}
protected override void OnInitialized()
{
base.OnInitialized();
Shuffle();
StateHasChanged();
}
}