From 276ffe0343ee6cba5783641f85554f34d008f32a Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 13 Feb 2023 20:52:00 +0000 Subject: [PATCH] Fixes #2348. The Basic Colors scenario doesn't output the blue on white properly. --- UICatalog/Scenarios/BasicColors.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/UICatalog/Scenarios/BasicColors.cs b/UICatalog/Scenarios/BasicColors.cs index b5110b33d..d88128206 100644 --- a/UICatalog/Scenarios/BasicColors.cs +++ b/UICatalog/Scenarios/BasicColors.cs @@ -1,4 +1,5 @@ -using Terminal.Gui; +using System.Linq; +using Terminal.Gui; namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Basic Colors", Description: "Show all basic colors.")] @@ -10,16 +11,18 @@ namespace UICatalog.Scenarios { var vx = 30; var x = 30; var y = 14; - var colors = System.Enum.GetValues (typeof (Color)); + var colors = System.Enum.GetValues (typeof (Color)).Cast ().ToArray (); - foreach (Color bg in colors) { + for (int i = 0; i < colors.Length; i++) { + Color bg = colors [i]; + Attribute attr = new Attribute (bg, colors [colors.Length - 1 - i]); var vl = new Label (bg.ToString (), TextDirection.TopBottom_LeftRight) { X = vx, Y = 0, Width = 1, Height = 13, VerticalTextAlignment = VerticalTextAlignment.Bottom, - ColorScheme = new ColorScheme () { Normal = new Attribute (bg, colors.Length - 1 - bg) } + ColorScheme = new ColorScheme () { Normal = attr } }; Win.Add (vl); var hl = new Label (bg.ToString ()) { @@ -28,7 +31,7 @@ namespace UICatalog.Scenarios { Width = 13, Height = 1, TextAlignment = TextAlignment.Right, - ColorScheme = new ColorScheme () { Normal = new Attribute (bg, colors.Length - 1 - bg) } + ColorScheme = new ColorScheme () { Normal = attr } }; Win.Add (hl); vx++;