更新整理
This commit is contained in:
@@ -224,7 +224,7 @@ public sealed partial class ColorPickerControl
|
||||
DetailsFlyout.Hide();
|
||||
}
|
||||
|
||||
private void OnDetailsFlyoutClosed(object sender, object e)
|
||||
private void OnDetailsFlyoutClosed(Flyout sender, RoutedEventArgs e)
|
||||
{
|
||||
HideDetails();
|
||||
|
||||
@@ -234,7 +234,10 @@ public sealed partial class ColorPickerControl
|
||||
|
||||
HexCode.Text = ColorToHex(_originalColor);
|
||||
}
|
||||
|
||||
// private void OnDetailsFlyoutClosed(Flyout sender, RoutedEventArgs args)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
private void OnColorVariationButtonClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var selectedColor = ((SolidColorBrush)((System.Windows.Controls.Button)sender).Background).Color;
|
||||
@@ -402,4 +405,6 @@ public sealed partial class ColorPickerControl
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
@@ -14,7 +10,7 @@ public static class HsvColor
|
||||
{
|
||||
var rgbs = new Color[360];
|
||||
|
||||
for(var h = 0; h < 360; h++)
|
||||
for (var h = 0; h < 360; h++)
|
||||
{
|
||||
rgbs[h] = RgbFromHsv(h, 1f, 1f);
|
||||
}
|
||||
@@ -26,7 +22,7 @@ public static class HsvColor
|
||||
{
|
||||
var rgbs = new Color[7];
|
||||
|
||||
for(var h = 0; h < 7; h++)
|
||||
for (var h = 0; h < 7; h++)
|
||||
{
|
||||
rgbs[h] = RgbFromHsv(h * 60, saturation, value);
|
||||
}
|
||||
@@ -36,7 +32,7 @@ public static class HsvColor
|
||||
|
||||
public static Color RgbFromHsv(double h, double s, double v)
|
||||
{
|
||||
if(h > 360 || h < 0 || s > 1 || s < 0 || v > 1 || v < 0)
|
||||
if (h > 360 || h < 0 || s > 1 || s < 0 || v > 1 || v < 0)
|
||||
{
|
||||
return Color.FromRgb(0, 0, 0);
|
||||
}
|
||||
@@ -47,32 +43,32 @@ public static class HsvColor
|
||||
|
||||
double r = 0, g = 0, b = 0;
|
||||
|
||||
if(h < 60)
|
||||
if (h < 60)
|
||||
{
|
||||
r = c;
|
||||
g = x;
|
||||
}
|
||||
else if(h < 120)
|
||||
else if (h < 120)
|
||||
{
|
||||
r = x;
|
||||
g = c;
|
||||
}
|
||||
else if(h < 180)
|
||||
else if (h < 180)
|
||||
{
|
||||
g = c;
|
||||
b = x;
|
||||
}
|
||||
else if(h < 240)
|
||||
else if (h < 240)
|
||||
{
|
||||
g = x;
|
||||
b = c;
|
||||
}
|
||||
else if(h < 300)
|
||||
else if (h < 300)
|
||||
{
|
||||
r = x;
|
||||
b = c;
|
||||
}
|
||||
else if(h <= 360)
|
||||
else if (h <= 360)
|
||||
{
|
||||
r = c;
|
||||
b = x;
|
||||
|
||||
Reference in New Issue
Block a user