private async void OnDuoTonePickColorButtonClick(object sender, RoutedEventArgs eventArgs) { Color currentColor = ColorConvertors.HslToColor(((float)duoToneHueNumeric.Value, (float)duoToneSaturationNumeric.Value, 0.5f)); SelectColorWindow dialog = new SelectColorWindow(currentColor); Color result = await dialog.ShowDialog <Color>(this); var hslColor = ColorConvertors.ColorToHsl(result); duoToneHueNumeric.Value = hslColor.H; duoToneSaturationNumeric.Value = hslColor.S; }
private void ReloadColorHex() { if (colorChanged || !Regex.IsMatch(colorHexTextBox.Text, @"#?[0-9a-fA-F]{6}")) { return; } colorChanged = true; CurrentColor = ColorConvertors.HexToColor(colorHexTextBox.Text); colorRNumeric.Value = CurrentColor.R; colorGNumeric.Value = CurrentColor.G; colorBNumeric.Value = CurrentColor.B; var hsl = ColorConvertors.ColorToHsl(CurrentColor); colorHNumeric.Value = hsl.H; colorSNumeric.Value = hsl.S; colorLNumeric.Value = hsl.L; ReloadColorMain(); }
private void ReloadColorRgb() { if (colorChanged) { return; } colorChanged = true; int r = (int)colorRNumeric.Value; int g = (int)colorGNumeric.Value; int b = (int)colorBNumeric.Value; CurrentColor = Color.FromArgb(r, g, b); var hsl = ColorConvertors.ColorToHsl(CurrentColor); colorHNumeric.Value = hsl.H; colorSNumeric.Value = hsl.S; colorLNumeric.Value = hsl.L; colorHexTextBox.Text = ColorConvertors.ColorToHex(CurrentColor); ReloadColorMain(); }