CreamsConsole-Utilities 1.3.1

dotnet add package CreamsConsole-Utilities --version 1.3.1                
NuGet\Install-Package CreamsConsole-Utilities -Version 1.3.1                
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="CreamsConsole-Utilities" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CreamsConsole-Utilities --version 1.3.1                
#r "nuget: CreamsConsole-Utilities, 1.3.1"                
#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 CreamsConsole-Utilities as a Cake Addin
#addin nuget:?package=CreamsConsole-Utilities&version=1.3.1

// Install CreamsConsole-Utilities as a Cake Tool
#tool nuget:?package=CreamsConsole-Utilities&version=1.3.1                

CreamsConsole-Utilities

A Console Utilities library inspired by spectre console focused on customization and good looking console applications

NuGet Package: https://www.nuget.org/packages/CreamsConsole-Utilities

Github Source code: https://github.com/joloboy20071/CreamsConsole-Utilities

Docs (work in progress): https://docs.creams-productions.nl/projects/creams-console-utilities-package-documentation

1.3.1 Fixed Bug in Boxrendering not showing Color in box outline

Projects

A simple Terminal Euro Truck 2 Dashboard project made with Creams Console Utilities alt text

example code

Create Simple TUI's With Creams Console Utilities

using CreamsConsole_utils;

Console.OutputEncoding = Encoding.UTF8;

int collum = (Console.BufferWidth / 5);
int row = (Console.BufferHeight / 3);

var box1 = Boxrendering.RenderBoxAtplace(collum * 3, (row * 2)+1, new Location((0 * collum), 0), "Box 1");
var box21 = Boxrendering.RenderBoxAtplace(collum * 1, (row * 1) + 1, new Location((3*collum),0), "BOX 2.1");
var box22=  Boxrendering.RenderBoxAtplace((collum * 1), (row * 1)+1 , new Location((3 * collum), (row * 1)), "BOX 2.2", ColorText.HexToRGB(ColorText.allColors["Blue"]));
var box3 = Boxrendering.RenderBoxAtplace(collum * 5, (row * 1) + 1, new Location(0, (row*2)),"BOX 3");


foreach (var box in Boxrendering.boxTypes) {
    Boxrendering.WriteLineInBox(FiggleFonts.Standard.Render($"{box.WritableHeight} X {box.WritableWidth}"), box, 0,0,false, ColorText.HexToRGB(ColorText.allColors["Gray"]));
}
bool Active =true;
while (Active)
{
    Console.SetCursorPosition(Console.BufferWidth - 1, Console.BufferHeight - 1);
    var key = Console.ReadKey();
    if ( key.Key == ConsoleKey.Escape) { Active = false; }
}


output

alt text

quick Experemental Documentation of TUI

public class Location(int x, int y)
// stores a location in the terminal

public class BoxType(Location location, int width, int height, string? Title) 
//Holdes box data

public static void WriteSingleInBox(string messgae  ,BoxType box , int StartAtY = 0, Color? color = null)
// writes string to box Without newline

public static void WriteLineInBox(string messgae, BoxType box, int startAtX=0, int StartAtY = 0,bool Center=false, Color? color = null)
// samge as WriteSinglelineinBox but with new line 

public static void WriteLineInLineBox(string messgae, BoxType box, int startAtX = 0, int StartAtY = 0, bool Center = false, Color? color = null,int? limit=null)
// sane as WriteLineInBox but with in line color 

public static void ClearBox(BoxType box) 
// Clears all lines in a box

public static void writeAtPost(string message, int x, int y, Color color)
// Write message at a posistion in the terminal

public static void writeInLineAtPost(string message, int x, int y)
// same as writeAtPost but with a new line

public static BoxType RenderBoxAtplace(int witdh, int height, Location location, string? title=null, Color? colorFrame = null, Color? colorTitle = null)
//Writes a box to terminal and return the box type

Write Colored text with in line syntax

using CreamsConsole_utils;

ColorText.CreateCustomColor("MidnightBlue", "#191970");//Define your own custom colors. must have hex value when defining custom colors
ColorText.ColorWriteIn("[/]{Invert}_Red[/]foo[//] [/]{Bold,UnderLine}_MidnightBlue[/]bar[//] , [/]{Italic,Strike}_[/]foo[//][/]Green[/] bar[//]");//Have Inline styling asswell 
 //Supported style  modifiers are [Invert,Bold,Strike,Italic,UnderLine]

output

alt text

Simple Selection menu example

using CreamsConsole_utils;

selectionMenu.config config = new selectionMenu.config() { };

config.AddChoise("Option 1", "returnID 1"); // add option with title and a return id 
config.AddChoise("Option 2", "returnID 2");
config.AddChoise("Option 3"); // add option with title and a return id = title
config.title = "Im a title";
config.description = "im a discription";


string output = selectionMenu.runtimeMenu(config);
Console.WriteLine(output);

output

alt text

Simple Selection menu example without exit

using CreamsConsole_utils;

selectionMenu.config config = new selectionMenu.config() { };

config.AddChoise("Option 1", "returnID 1"); // add option with title and a return id 
config.AddChoise("Option 2", "returnID 2");
config.AddChoise("Option 3"); // add option with title and a return id = title
config.title = "Im a title"; // sets the title
config.description = "im a discription";

config.HasExit = false;
string output = selectionMenu.runtimeMenu(config);
Console.WriteLine(output);

output

alt text

Simple multi Selection Menu

using CreamsConsole_utils;


MultiSelectionMenu.config config = new MultiSelectionMenu.config() { };

config.AddChoise("Option 1", "returnID 1", true); //add a option with Title: option 1, a returnID and set the option to true
config.AddChoise("Option 2", "returnID 2");// add a option with Title: option 2, a returnID and set the option to false
config.AddChoise("Option 3", true); //add a option with Title: option 3, a returnID = option title and set the option to true
config.title = "Im a title"; //Set the Menu title  
config.description = "im a discription"; // Set the menu discription 

MultiSelectionMenu.ReturnedData Output = MultiSelectionMenu.runtimeMenu(config);

if (Output.isSaved) { for (int i = 0; i < Output.returnIDS.Count; i++) { Console.WriteLine($"{Output.returnIDS[i]} -> {Output.returnDict[Output.returnIDS[i]]}"); } }

output

alt text

Simple progress bar

using CreamsConsole_utils;

ProgressBars progressBar = new ProgressBars();

ProgressBars.ProgresBarConfig progresBarConfig = new ProgressBars.ProgresBarConfig();



progresBarConfig.totalTasks = 100; //set the amount of tasks to complete
progresBarConfig.TaskName = "task";// set the main progeess bar name

int bar = progressBar.startBar(progresBarConfig);

for (int i = 0; i < progresBarConfig.totalTasks; i++) {
    Thread.Sleep(100); // do some work
    progressBar.UpdateBar(i + 1, progresBarConfig, bar);// update the progress bar
}

output

alt text

alt text

Product Compatible and additional computed target framework versions.
.NET 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.
  • net8.0

    • No dependencies.

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
1.3.1 97 8/28/2024
1.3.0 94 8/27/2024
1.2.0 96 8/26/2024
1.1.2 108 8/24/2024
1.1.1 115 8/23/2024
1.1.0 112 8/23/2024

1.3.1 Fixed Bug in Boxrendering not showing Color in box outline