mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Add InvertColors scenario.
This commit is contained in:
32
UICatalog/Scenarios/InvertColors.cs
Normal file
32
UICatalog/Scenarios/InvertColors.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user