mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[ColorPicker] HEX format tweak (#13989)
* Added HEX2
* Revert "Added HEX2"
This reverts commit 6d7b23fd74.
* Lowercase HEX without hash
* Update ColorRepresentationHelper.cs
* Update expect.txt
Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
1
.github/actions/spell-check/expect.txt
vendored
1
.github/actions/spell-check/expect.txt
vendored
@@ -655,6 +655,7 @@ finalizer
|
|||||||
findfast
|
findfast
|
||||||
findstr
|
findstr
|
||||||
FIXEDFILEINFO
|
FIXEDFILEINFO
|
||||||
|
FFAA
|
||||||
FLASHZONES
|
FLASHZONES
|
||||||
FLASHZONESONQUICKSWITCH
|
FLASHZONESONQUICKSWITCH
|
||||||
flt
|
flt
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace ColorPicker.Helpers
|
|||||||
/// <param name="color">The see cref="Color"/> for the hexadecimal presentation</param>
|
/// <param name="color">The see cref="Color"/> for the hexadecimal presentation</param>
|
||||||
/// <returns>A hexadecimal <see cref="string"/> representation of a RGB color</returns>
|
/// <returns>A hexadecimal <see cref="string"/> representation of a RGB color</returns>
|
||||||
private static string ColorToHex(Color color)
|
private static string ColorToHex(Color color)
|
||||||
=> $"#{color.R.ToString("X2", CultureInfo.InvariantCulture)}"
|
=> $"{color.R.ToString("X2", CultureInfo.InvariantCulture)}"
|
||||||
+ $"{color.G.ToString("X2", CultureInfo.InvariantCulture)}"
|
+ $"{color.G.ToString("X2", CultureInfo.InvariantCulture)}"
|
||||||
+ $"{color.B.ToString("X2", CultureInfo.InvariantCulture)}";
|
+ $"{color.B.ToString("X2", CultureInfo.InvariantCulture)}";
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,9 @@ namespace ColorPicker.ViewModels
|
|||||||
new ColorFormatModel()
|
new ColorFormatModel()
|
||||||
{
|
{
|
||||||
FormatName = ColorRepresentationType.HEX.ToString(),
|
FormatName = ColorRepresentationType.HEX.ToString(),
|
||||||
Convert = (Color color) => { return ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HEX); },
|
#pragma warning disable CA1304 // Specify CultureInfo
|
||||||
|
Convert = (Color color) => { return ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HEX).ToLower(); },
|
||||||
|
#pragma warning restore CA1304 // Specify CultureInfo
|
||||||
});
|
});
|
||||||
|
|
||||||
_allColorRepresentations.Add(
|
_allColorRepresentations.Add(
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Microsoft.ColorPicker.UnitTests
|
|||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[DataRow(ColorRepresentationType.CMYK, "cmyk(0%, 0%, 0%, 100%)")]
|
[DataRow(ColorRepresentationType.CMYK, "cmyk(0%, 0%, 0%, 100%)")]
|
||||||
[DataRow(ColorRepresentationType.HEX, "#000000")]
|
[DataRow(ColorRepresentationType.HEX, "000000")]
|
||||||
[DataRow(ColorRepresentationType.NCol, "R0, 0%, 100%")]
|
[DataRow(ColorRepresentationType.NCol, "R0, 0%, 100%")]
|
||||||
[DataRow(ColorRepresentationType.HSB, "hsb(0, 0%, 0%)")]
|
[DataRow(ColorRepresentationType.HSB, "hsb(0, 0%, 0%)")]
|
||||||
[DataRow(ColorRepresentationType.HSI, "hsi(0, 0%, 0%)")]
|
[DataRow(ColorRepresentationType.HSI, "hsi(0, 0%, 0%)")]
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
SelectableColorRepresentations = new Dictionary<ColorRepresentationType, string>
|
SelectableColorRepresentations = new Dictionary<ColorRepresentationType, string>
|
||||||
{
|
{
|
||||||
{ ColorRepresentationType.CMYK, "CMYK - cmyk(100%, 50%, 75%, 0%)" },
|
{ ColorRepresentationType.CMYK, "CMYK - cmyk(100%, 50%, 75%, 0%)" },
|
||||||
{ ColorRepresentationType.HEX, "HEX - #FFAA00" },
|
{ ColorRepresentationType.HEX, "HEX - ffaa00" },
|
||||||
{ ColorRepresentationType.HSB, "HSB - hsb(100, 50%, 75%)" },
|
{ ColorRepresentationType.HSB, "HSB - hsb(100, 50%, 75%)" },
|
||||||
{ ColorRepresentationType.HSI, "HSI - hsi(100, 50%, 75%)" },
|
{ ColorRepresentationType.HSI, "HSI - hsi(100, 50%, 75%)" },
|
||||||
{ ColorRepresentationType.HSL, "HSL - hsl(100, 50%, 75%)" },
|
{ ColorRepresentationType.HSL, "HSL - hsl(100, 50%, 75%)" },
|
||||||
@@ -199,7 +199,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
var cielabFormatName = ColorRepresentationType.CIELAB.ToString();
|
var cielabFormatName = ColorRepresentationType.CIELAB.ToString();
|
||||||
var ciexyzFormatName = ColorRepresentationType.CIEXYZ.ToString();
|
var ciexyzFormatName = ColorRepresentationType.CIEXYZ.ToString();
|
||||||
|
|
||||||
formatsUnordered.Add(new ColorFormatModel(hexFormatName, "#EF68FF", visibleFormats.ContainsKey(hexFormatName) && visibleFormats[hexFormatName]));
|
formatsUnordered.Add(new ColorFormatModel(hexFormatName, "ef68ff", visibleFormats.ContainsKey(hexFormatName) && visibleFormats[hexFormatName]));
|
||||||
formatsUnordered.Add(new ColorFormatModel(rgbFormatName, "rgb(239, 104, 255)", visibleFormats.ContainsKey(rgbFormatName) && visibleFormats[rgbFormatName]));
|
formatsUnordered.Add(new ColorFormatModel(rgbFormatName, "rgb(239, 104, 255)", visibleFormats.ContainsKey(rgbFormatName) && visibleFormats[rgbFormatName]));
|
||||||
formatsUnordered.Add(new ColorFormatModel(hslFormatName, "hsl(294, 100%, 70%)", visibleFormats.ContainsKey(hslFormatName) && visibleFormats[hslFormatName]));
|
formatsUnordered.Add(new ColorFormatModel(hslFormatName, "hsl(294, 100%, 70%)", visibleFormats.ContainsKey(hslFormatName) && visibleFormats[hslFormatName]));
|
||||||
formatsUnordered.Add(new ColorFormatModel(hsvFormatName, "hsv(294, 59%, 100%)", visibleFormats.ContainsKey(hsvFormatName) && visibleFormats[hsvFormatName]));
|
formatsUnordered.Add(new ColorFormatModel(hsvFormatName, "hsv(294, 59%, 100%)", visibleFormats.ContainsKey(hsvFormatName) && visibleFormats[hsvFormatName]));
|
||||||
|
|||||||
Reference in New Issue
Block a user