correct order + correct docu

This commit is contained in:
Sekan, Tobias 2020-10-26 15:24:37 +01:00
parent 767ce22019
commit c4eccb3666
3 changed files with 47 additions and 47 deletions

View File

@ -6,49 +6,49 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
{
public enum ColorRepresentationType
{
/// <summary>
/// Color presentation as hexadecimal color value without the alpha-value (e.g. #0055FF)
/// </summary>
HEX = 0,
/// <summary>
/// Color presentation as RGB color value (red[0..255], green[0..255], blue[0..255])
/// </summary>
RGB = 1,
/// <summary>
/// Color presentation as CMYK color value (cyan[0%..100%], magenta[0%..100%], yellow[0%..100%], black key[0%..100%])
/// </summary>
CMYK = 2,
CMYK = 0,
/// <summary>
/// Color presentation as HSL color value (hue[0°..360°], saturation[0..100%], lightness[0%..100%])
/// Color presentation as hexadecimal color value without the alpha-value (e.g. #0055FF)
/// </summary>
HSL = 3,
/// <summary>
/// Color presentation as HSV color value (hue[0°..360°], saturation[0%..100%], value[0%..100%])
/// </summary>
HSV = 4,
HEX = 1,
/// <summary>
/// Color presentation as HSB color value (hue[0°..360°], saturation[0%..100%], brightness[0%..100%])
/// </summary>
HSB = 5,
HSB = 2,
/// <summary>
/// Color presentation as HSI color value (hue[0°..360°], saturation[0%..100%], value[0%..100%])
/// Color presentation as HSI color value (hue[0°..360°], saturation[0%..100%], intensity[0%..100%])
/// </summary>
HSI = 6,
HSI = 3,
/// <summary>
/// Color presentation as HSL color value (hue[0°..360°], saturation[0..100%], lightness[0%..100%])
/// </summary>
HSL = 4,
/// <summary>
/// Color presentation as HSV color value (hue[0°..360°], saturation[0%..100%], value[0%..100%])
/// </summary>
HSV = 5,
/// <summary>
/// Color presentation as HWB color value (hue[0°..360°], whiteness[0%..100%], blackness[0%..100%])
/// </summary>
HWB = 7,
HWB = 6,
/// <summary>
/// Color presentation as natural color (hue, saturation[0%..100%], value[0%..100%])
/// Color presentation as natural color (hue, whiteness[0%..100%], blackness[0%..100%])
/// </summary>
NCol = 8,
NCol = 7,
/// <summary>
/// Color presentation as RGB color value (red[0..255], green[0..255], blue[0..255])
/// </summary>
RGB = 8,
}
}

View File

@ -69,15 +69,15 @@
IsEnabled="{Binding IsEnabled}"
HorizontalAlignment="Left"
MinWidth="240">
<ComboBoxItem Content="HEX - #FFAA00"/>
<ComboBoxItem Content="RGB - rgb(100, 50, 75)"/>
<ComboBoxItem Content="CMYK - cmyk(100%, 50%, 75%, 0%)"/>
<ComboBoxItem Content="HSL - hsl(100, 50%, 75%)"/>
<ComboBoxItem Content="HSV - hsv(100, 50%, 75%)"/>
<ComboBoxItem Content="HEX - #FFAA00"/>
<ComboBoxItem Content="HSB - hsb(100, 50%, 75%)"/>
<ComboBoxItem Content="HSI - hsi(100, 50%, 75%)"/>
<ComboBoxItem Content="HSL - hsl(100, 50%, 75%)"/>
<ComboBoxItem Content="HSV - hsv(100, 50%, 75%)"/>
<ComboBoxItem Content="HBW - hbw(100, 50%, 75%)"/>
<ComboBoxItem Content="NCob - 10R, 50%, 75%"/>
<ComboBoxItem Content="NCol - 10R, 50%, 75%"/>
<ComboBoxItem Content="RGB - rgb(100, 50, 75)"/>
</ComboBox>
<!--

View File

@ -24,13 +24,13 @@ namespace ColorPicker.Helpers
=> colorRepresentationType switch
{
ColorRepresentationType.CMYK => ColorToCYMK(color),
ColorRepresentationType.NCol => ColorToNCol(color),
ColorRepresentationType.HEX => ColorToHex(color),
ColorRepresentationType.HSB => ColorToHSB(color),
ColorRepresentationType.HSI => ColorToHSI(color),
ColorRepresentationType.HSL => ColorToHSL(color),
ColorRepresentationType.HSV => ColorToHSV(color),
ColorRepresentationType.HWB => ColorToHWB(color),
ColorRepresentationType.NCol => ColorToNCol(color),
ColorRepresentationType.RGB => ColorToRGB(color),
// Fall-back value, when "_userSettings.CopiedColorRepresentation.Value" is incorrect
@ -57,23 +57,6 @@ namespace ColorPicker.Helpers
+ $", {blackKey.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a <see cref="string"/> representation of a natural color
/// </summary>
/// <param name="color">The <see cref="Color"/> for the natural color presentation</param>
/// <returns>A <see cref="string"/> representation of a natural color</returns>
private static string ColorToNCol(Color color)
{
var (hue, whiteness, blackness) = ColorHelper.ConvertToNaturalColor(color);
whiteness = Math.Round(whiteness * 100);
blackness = Math.Round(blackness * 100);
return $"{hue}"
+ $", {whiteness.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackness.ToString(CultureInfo.InvariantCulture)}%";
}
/// <summary>
/// Return a hexadecimal <see cref="string"/> representation of a RGB color
/// </summary>
@ -176,6 +159,23 @@ namespace ColorPicker.Helpers
+ $", {blackness.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a <see cref="string"/> representation of a natural color
/// </summary>
/// <param name="color">The <see cref="Color"/> for the natural color presentation</param>
/// <returns>A <see cref="string"/> representation of a natural color</returns>
private static string ColorToNCol(Color color)
{
var (hue, whiteness, blackness) = ColorHelper.ConvertToNaturalColor(color);
whiteness = Math.Round(whiteness * 100);
blackness = Math.Round(blackness * 100);
return $"{hue}"
+ $", {whiteness.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackness.ToString(CultureInfo.InvariantCulture)}%";
}
/// <summary>
/// Return a <see cref="string"/> representation of a RGB color
/// </summary>