From edece4a7eefd412a220e1bdaa1f6d8f06b492ddd Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Sat, 1 Feb 2025 14:06:58 +0300 Subject: [PATCH] imp - Clarified all color models when pressing I --- When you press I in the color selector, it now clarifies all color models using their class name to reduce confusion. --- Type: imp Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- .../Inputs/Interactive/Selectors/ColorSelectorTui.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/Terminaux/Inputs/Interactive/Selectors/ColorSelectorTui.cs b/public/Terminaux/Inputs/Interactive/Selectors/ColorSelectorTui.cs index 9d7ca127e..fff11b759 100644 --- a/public/Terminaux/Inputs/Interactive/Selectors/ColorSelectorTui.cs +++ b/public/Terminaux/Inputs/Interactive/Selectors/ColorSelectorTui.cs @@ -21,6 +21,7 @@ using System.Linq; using System.Text; using Terminaux.Base; +using Terminaux.Base.Extensions; using Terminaux.Colors; using Terminaux.Colors.Data; using Terminaux.Colors.Gradients; @@ -559,12 +560,13 @@ private string ShowColorInfo(Color selectedColor, bool colorBlind = false, Trans // Get all the types except RGB and show their values individually var baseType = typeof(BaseColorModel); var derivedTypes = baseType.Assembly.GetTypes().Where((type) => type.IsSubclassOf(baseType) && type != typeof(RedGreenBlue)).ToArray(); + int maxBindingLength = derivedTypes.Max((colorType) => ConsoleChar.EstimateCellWidth(colorType.Name)); StringBuilder builder = new(); foreach (var colorType in derivedTypes) { // Get the value var converted = ConversionTools.ConvertFromRgb(selectedColor.RGB, colorType); - builder.AppendLine(converted.ToString()); + builder.AppendLine(colorType.Name + new string(' ', maxBindingLength - ConsoleChar.EstimateCellWidth(colorType.Name)) + $" | {converted}"); } return $$""" @@ -572,7 +574,9 @@ private string ShowColorInfo(Color selectedColor, bool colorBlind = false, Trans True: {{selectedColor.PlainSequenceTrueColor}} Hex: {{selectedColor.Hex}} Type: {{selectedColor.Type}} - + + --- + {{builder}} """; }