Add InvertColors scenario.

This commit is contained in:
BDisp
2021-07-06 12:52:35 +01:00
parent 7c1083114d
commit f256046984

View File

@@ -0,0 +1,32 @@
using Terminal.Gui;
namespace UICatalog {
[ScenarioMetadata (Name: "Invert Colors", Description: "Invert the foreground and the background colors.")]
[ScenarioCategory ("Colors")]
class InvertColors : Scenario {
public override void Setup ()
{
Win.ColorScheme = Colors.TopLevel;
var color = Application.Driver.MakeAttribute (Color.Red, Color.Blue);
var label = new Label ("Test") {
ColorScheme = new ColorScheme()
};
label.ColorScheme.Normal = color;
Win.Add (label);
var button = new Button ("Invert color!") {
X = Pos.Center (),
Y = Pos.Center (),
};
button.Clicked += () => {
color = Application.Driver.MakeAttribute (color.Background, color.Foreground);
label.ColorScheme.Normal = color;
label.SetNeedsDisplay ();
};
Win.Add (button);
}
}
}