Skip to content

Commit

Permalink
Fixed: "Generate random color" button doesn't work in "HEX" mode (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Nov 20, 2021
1 parent a51483a commit 02f081b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ColorPicker/Pages/PalettePage.xaml.cs
Expand Up @@ -190,7 +190,12 @@ private void RandomColorBtn_Click(object sender, RoutedEventArgs e)
g = random.Next(0, 255); // Generate random number between 0 and 255
b = random.Next(0, 255); // Generate random number between 0 and 255

RGBTxt.Text = $"{r}{Global.Settings.RGBSeparator}{g}{Global.Settings.RGBSeparator}{b}"; // Set text
RGBTxt.Text = ColorTypeComboBox.SelectedIndex switch
{
0 => $"{r}{Global.Settings.RGBSeparator}{g}{Global.Settings.RGBSeparator}{b}", // Set text
1 => $"#{ColorHelper.ColorConverter.RgbToHex(new((byte)r, (byte)g, (byte)b)).Value}", // Set text
_ => $"{r}{Global.Settings.RGBSeparator}{g}{Global.Settings.RGBSeparator}{b}" // Set text
};
}

private string GetRgbStringFromBorder(Border border)
Expand Down

0 comments on commit 02f081b

Please sign in to comment.