[ColorPicker]Support BGR and RGB decimal value formats (#22771)

* ColorPicker add both decimal value formats

* ColorPicker, custom format dialog, resizing columns
This commit is contained in:
Laszlo Nemeth
2022-12-15 10:33:17 +01:00
committed by GitHub
parent 5b4e678f14
commit 96ac6a6a12
3 changed files with 22 additions and 13 deletions

View File

@@ -285,7 +285,8 @@ namespace ManagedCommon
{ "Xv", 'i' }, // X value int
{ "Yv", 'i' }, // Y value int
{ "Zv", 'i' }, // Z value int
{ "Dv", 'i' }, // Decimal value int
{ "Dr", 'i' }, // Decimal value (RGB) int
{ "Dv", 'i' }, // Decimal value (BGR) int
{ "Na", 's' }, // Color name string
};
@@ -447,8 +448,10 @@ namespace ManagedCommon
var (_, _, z) = ConvertToCIEXYZColor(color);
z = Math.Round(z * 100, 4);
return z.ToString(CultureInfo.InvariantCulture);
case "Dv":
case "Dr":
return ((color.R * 65536) + (color.G * 256) + color.B).ToString(CultureInfo.InvariantCulture);
case "Dv":
return (color.R + (color.G * 256) + (color.B * 65536)).ToString(CultureInfo.InvariantCulture);
case "Na":
return ColorNameHelper.GetColorName(color);
default: return string.Empty;