ConsoleAppVisuals 3.5.0-alpha

Prefix Reserved
This is a prerelease version of ConsoleAppVisuals.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ConsoleAppVisuals --version 3.5.0-alpha                
NuGet\Install-Package ConsoleAppVisuals -Version 3.5.0-alpha                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConsoleAppVisuals" Version="3.5.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConsoleAppVisuals --version 3.5.0-alpha                
#r "nuget: ConsoleAppVisuals, 3.5.0-alpha"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ConsoleAppVisuals as a Cake Addin
#addin nuget:?package=ConsoleAppVisuals&version=3.5.0-alpha&prerelease

// Install ConsoleAppVisuals as a Cake Tool
#tool nuget:?package=ConsoleAppVisuals&version=3.5.0-alpha&prerelease                

ConsoleAppVisuals

User-friendly .NET visuals library designed for console apps.

version NuGet GitHub Coverage Status License: GNU GPL

title

Documentation

Feel free to check out the following resources to help you get started:

First steps into the library

If you have been using the library before v3, please note that the library has been completely rewritten. The old version is not compatible with the new one. Please take the time to explore our documentation to update your code.

Principle

The library is designed to be user-friendly and easy to use. It is based on the concept of "visuals" which are elements that can be displayed in the console. There are two types of visuals:

  • Passive visuals: elements that do not change by themselves, you may display several from the same type at the same time
  • Interactive visuals: elements that can be updated and create a response that can be collected, you may display only one at a time

These visuals are stored in Window as a list. From this class, you can display the visuals, add, remove, or update them. Each one of the visual element has its rendering method that lets the Window display it.

The basics of the interaction between the library and the console are defined in the Core class.

Install

Install the library for your project using the .NET CLI:

dotnet add package ConsoleAppVisuals

Install the library for Visual Studio users, go through this tutorial.

Or Enter the following command in the Package Manager Console in Visual Studio:

Install-Package ConsoleAppVisuals

Use flow

After installing the library, do not forget to add the following statement at the beginning of your file:

using ConsoleAppVisuals;
using ConsoleAppVisuals.Elements;

And then, add the following line to your Main method to set up the console:

Window.Open();
Work with static elements

The first step is to create an element to display. For example, let's create a Title element:

Title exampleTitle = new Title("Hello world!");

Then, you can add it to Window:

Window.AddElement(exampleTitle);

Finally, you can display the Window:

Window.Render();

Now at each refresh, the Title element will appear on screen. To disable it, you can use:

Window.DeactivateElement(exampleTitle);

Or simply remove it from the list:

Window.RemoveElement(exampleTitle);
Work with interactive elements

The process is similar to the static elements. The difference is that you can get a response from your interaction with these elements. Let's create a Prompt element:

Prompt examplePrompt = new Prompt("What is your name?");

Then, you can add it to Window:

Window.AddElement(examplePrompt);

Finally, you can display the Window, remember that interactive element are disabled by default:

// Add this line if you have static elements to display
Window.Render();

Window.ActivateElement(examplePrompt);

To get the response simply add:

var responsePrompt = examplePrompt.GetResponse();

Access to the response data using:

// Get the state of the response : Enter, Escape, or Backspace
Console.WriteLine(responsePrompt?.State);

// Get the response data, here a Prompt always return a string
Console.WriteLine(responsePrompt?.Info);

The InteractiveElement object deactivate themselves after their execution.

You may now remove the element from the list if you want to:

Window.RemoveElement(examplePrompt);
Exit the program

Do not forget to close the Window at the end of your program:

Window.Close();

Supported .NET versions

Version Supported
net8.x
net7.x
net6.x
< net6.x

Security Policy

Consider reading our SECURITY policy to know more about how we handle security issues and how to report them. You will also find the stable versions of the project.

Development team

Acknowledgments

Consider reading the ACKNOWlEDGMENTS file. It's a testament to the collaborative effort that has gone into improving and refining our library. We're deeply grateful to all our contributors for their invaluable input and the significant difference they've made to the project.

It also lists the open source projects that have been used to build this library until now.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. To do so, follow the steps described in the CONTRIBUTING file.

We are always open for feedback and discussions. If you are using our library and want to share your use case, or if you have any suggestions for improvement, please feel free to open an issue or open a discussion on our GitHub repository. Your input helps us understand possible use cases and make necessary improvements.

Do not hesitate to star and share the project if you like it!

License

Distributed under the GNU GPL v2.0 License. See LICENSE for more information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.5.4 75 11/15/2024
3.5.3 102 9/3/2024
3.5.2 170 4/20/2024
3.5.1 124 4/5/2024
3.5.0 111 4/2/2024
3.5.0-rc 102 4/2/2024
3.5.0-beta.1 60 3/28/2024
3.5.0-beta 96 3/27/2024
3.5.0-alpha 84 3/26/2024
3.4.0 117 3/23/2024
3.4.0-beta 98 3/22/2024
3.3.1 122 3/20/2024
3.3.0 133 3/16/2024
3.2.6 119 3/14/2024
3.2.5 111 3/14/2024
3.2.4 134 3/13/2024
3.2.3 130 3/7/2024
3.2.2 128 3/7/2024
3.2.1 103 3/7/2024
3.2.0 123 3/5/2024
3.1.3 123 3/4/2024
3.1.2 119 3/3/2024
3.1.1 139 3/2/2024
3.1.0 139 3/2/2024
3.0.8 104 2/29/2024
3.0.7 127 2/18/2024
3.0.6 119 2/17/2024
3.0.5 170 1/10/2024
3.0.4 130 1/7/2024
3.0.3 140 1/6/2024
3.0.2 142 1/2/2024
3.0.1 111 1/2/2024
3.0.0 116 1/1/2024
2.7.10 123 12/31/2023
2.7.9 110 12/30/2023
2.7.8 129 12/24/2023
2.7.7 116 12/17/2023
2.7.6 117 12/13/2023
2.7.5 127 12/13/2023
2.7.4 102 12/12/2023
2.7.3 114 12/12/2023
2.7.2 105 12/12/2023
2.7.1 84 12/12/2023
2.7.0 101 12/11/2023
2.6.2 97 12/11/2023
2.6.1 103 12/11/2023
2.6.0 114 12/11/2023
2.5.2 113 12/9/2023
2.5.1 128 12/8/2023
2.5.0 85 12/8/2023
2.4.4 117 12/6/2023
2.4.3 164 11/23/2023
2.4.2 115 11/23/2023
2.4.1 120 11/23/2023
2.3.0 118 11/21/2023
2.2.5 134 11/21/2023
2.2.4 134 11/21/2023
2.2.3 115 11/21/2023
2.2.2 115 11/21/2023
2.2.1 119 11/21/2023
2.2.0 133 11/21/2023
2.1.0 148 11/15/2023
2.0.4 107 11/13/2023
2.0.3 163 10/19/2023
2.0.2 130 10/19/2023
2.0.0 130 10/18/2023
1.0.5 114 10/16/2023
1.0.4 135 10/10/2023
1.0.3 113 10/10/2023
1.0.2 124 10/10/2023
1.0.1 123 10/10/2023
1.0.0 149 10/10/2023