* Readonly HSL view * Make it possible to move between bars by moving to subview * Basically working and with mouse support * Fix HSL to work properly with double values instead of color matching * Fix Value on ColorPicker to match HSL values * Fix color spectrum * Add Swatch and better sync with text box * Work on jitter * ColorPicker HSL working * More keybindings * Add ColorModel * Support both HSL and HSV * Add RGB * Better mouse handling * WIP: AttributeView and integrate into LineDrawing (does not currently work properly) * Fix color picking * Add concept of an ITool * Add ColorPickerStyle * Fix selected cell rendering * Add first test for ColorPicker2 * Add more RGB tests * Improve ColorPicker2 setup process * Tests and fixes for keyboard changing value R * Fix margin on bars when no textfields * Add mouse test * Add tests for with text field * Add more tests and fix bug sync component text field change with hex text field (WIP - failing tests) * Fix tests and fix clicking in a bar label area possibly not selecting * Move AttributeView to LineDrawing and adjust to have a 'transparent pattern' too * Render triangle in dark gray if background is black * Add ColorChanged event * Resharper Cleanup * Xml comments and public/private adjustments * Explore replacing diagram test with fragile Subview diving * Migrate ColorPicker_DefaultBoot to sub asserts * Port other tests * Replace ColorPicker with new view * Fix ColorPicker size to match scenarios size assumptions * Split to separate files and ignore invalid test for ColorPicker * Ignore also in mouse version of AllViews_Enter_Leave_Events * Remove bool _updating from ColorPicker Now instead we are more selective about what we update when and do so deterministically * Typo fix * Fix ReSharper bad renames in comments for "Value" * Refactor to single implementation of 'prompt for color' logic - Now called PromptForColor - Shared by LineDrawing and ProgressBarStyles scenarios * Sum runes instead of Length * Hide ColorBar and SetValueWithoutRaisingEvent from public API * Move ColorEventArgs to Drawing folder * Move ColorModel to Drawing folder * First try at Dim.Auto for ColorPicker * Remove explicit width/height setting in most scenarios * Remove explicit heights * Fixed build/test issues. Illustrated test best practice. * WIP: Start working on test changes and add new options to ColorPickers scenario (Color Model and show textfields). * Fix for R indicator arrow sometimes 'falling off' the drawn area. * Add nullable enable * Test fixes and refactor for avoiding Begin * Make ColorEventArgs inherit from EventArgs<Color> * Fix Dispose not being called on bars when switching color models * Remove 'oldColor' from test now it is not supported * Add initial stab at ColorPickerStyle.ShowName * Use AppendAutocomplete for color names * Implemented resoruce based colorname resolver * Update GetTextField to support getting the color names field Change style setting to ShowColorName * Color name updates when navigating away from the named color * Restore old color picker as ColorPicker16 * Add test that shows 'Save as' is currently considered a named color >< * Fix GetW3CColorNames * Removed dupe colors * Revert to old color pickers * Nullability question marks for everyone! --------- Co-authored-by: Tig <tig@users.noreply.github.com>
Terminal.Gui UI Catalog
UI Catalog is a comprehensive sample library for Terminal.Gui. It attempts to satisfy the following goals:
- Be an easy-to-use showcase for Terminal.Gui concepts and features.
- Provide sample code that illustrates how to properly implement said concepts & features.
- Make it easy for contributors to add additional samples in a structured way.
Motivation
The original demo.cs sample app for Terminal.Gui is neither good to showcase, nor does it explain different concepts. In addition, because it is built on a single source file, it has proven to cause friction when multiple contributors are simultaneously working on different aspects of Terminal.Gui.
See Issue #368 for more background.
API Reference
How To Use
Build and run UI Catalog by typing dotnet run from the UI Catalog folder or by using the Terminal.Gui Visual Studio solution.
Program.cs is the main UI Catalog app and provides a UI for selecting and running Scenarios. Each *Scenario is implemented as a class derived from Scenario and Program.cs uses reflection to dynamically build the UI.
Scenarios are tagged with categories using the [ScenarioCategory] attribute. The left pane of the main screen lists the categories. Clicking on a category shows all the scenarios in that category.
Scenarios can be run either from the UICatalog.exe app UI or by being specified on the command line:
UICatalog.exe <Scenario Name>
e.g.
UICatalog.exe Buttons
Hitting ENTER on a selected Scenario or double-clicking on a Scenario runs that scenario as though it were a stand-alone Terminal.Gui app.
When a Scenario is run, it runs as though it were a standalone Terminal.Gui app. However, scaffolding is provided (in the Scenario base class) that (optionally) takes care of Terminal.Gui initialization.
Contributing by Adding Scenarios
To add a new Scenario simply:
- Create a new
.csfile in theScenariosdirectory that derives fromScenario. - Add a
[ScenarioMetaData]attribute to the class specifying the scenario's name and description. - Add one or more
[ScenarioCategory]attributes to the class specifying which categories the sceanrio belongs to. If you don't specify a category the sceanrio will show up in "All". - Implement the
Setupoverride which will be called when a user selects the scenario to run. - Optionally, implement the
Initand/orRunoverrides to provide a custom implementation.
The sample below is provided in the .\UICatalog\Scenarios directory as a generic sample that can be copied and re-named:
using Terminal.Gui;
namespace UICatalog {
[ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")]
[ScenarioCategory ("Controls")]
class MyScenario : Scenario {
public override void Setup ()
{
// Put your scenario code here, e.g.
Win.Add (new Button () {
Text = "Press me!",
X = Pos.Center (),
Y = Pos.Center (),
Clicked = () => MessageBox.Query (20, 7, "Hi", "Neat?", "Yes", "No")
});
}
}
}
Scenario provides Win, a Window object that provides a canvas for the Scenario to operate.
The default Window shows the Scenario name and supports exiting the Scenario through the Esc key.
To build a more advanced scenario, where control of the Toplevel and Window is needed (e.g. for scenarios using MenuBar or StatusBar), simply use Application.Top per normal Terminal.Gui programming, as seen in the Notepad scenario.
For complete control, the Init and Run overrides can be implemented. The base.Init creates Win. The base.Run simply calls Application.Run(Application.Top).
Contribution Guidelines
- Provide a terse, descriptive
NameforScenarios. Keep them short. - Provide a clear
Description. - Comment
Scenariocode to describe to others why it's a usefulScenario. - Annotate
Scenarioswith[ScenarioCategory]attributes. Minimize the number of new categories created. - Use the
Bug RepoCategory forScenariosthat reproduce bugs.- Include the Github Issue # in the Description.
- Once the bug has been fixed in
developsubmit another PR to remove theScenario(or modify it to provide a good regression test/sample).
- Tag bugs or suggestions for
UI CatalogasTerminal.GuiGithub Issues with "UICatalog: ".

