Skip to content

Commit

Permalink
imp - Clarified all color models when pressing I
Browse files Browse the repository at this point in the history
---

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
  • Loading branch information
AptiviCEO committed Feb 1, 2025
1 parent ce03981 commit edece4a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -559,20 +560,23 @@ 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
$$"""
RGB: {{selectedColor.PlainSequence}}
True: {{selectedColor.PlainSequenceTrueColor}}
Hex: {{selectedColor.Hex}}
Type: {{selectedColor.Type}}
---
{{builder}}
""";
}
Expand Down

0 comments on commit edece4a

Please sign in to comment.