MST.Tools 0.3.1

dotnet add package MST.Tools --version 0.3.1
                    
NuGet\Install-Package MST.Tools -Version 0.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="MST.Tools" Version="0.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MST.Tools" Version="0.3.1" />
                    
Directory.Packages.props
<PackageReference Include="MST.Tools" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MST.Tools --version 0.3.1
                    
#r "nuget: MST.Tools, 0.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.
#:package MST.Tools@0.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MST.Tools&version=0.3.1
                    
Install as a Cake Addin
#tool nuget:?package=MST.Tools&version=0.3.1
                    
Install as a Cake Tool

MST.Tools

MST.Tools is a collection of useful console utilities for .NET CLI applications.

It provides features like themed output, colored text, structured menus, and input helpers.


✨ Features

  • Colorful output with custom RGB themes
  • Menu helpers for CLI apps
  • User input validation (string, int, decimal)
  • Exit confirmation prompts
  • Works on Windows, Linux, and macOS
  • Supports .NET Standard 2.0 and above

πŸ“¦ Installation

dotnet add package MST.Tools

πŸ”§ Usage

You can import the namespace normally:

using MST.Tools;

class Program
{
    static void Main()
    {
        ConsoleHelper.PrintSuccess("Operation completed successfully!");
        ConsoleHelper.PrintError("Something went wrong!");
    }
}

Or, if you don’t want to type ConsoleHelper. every time, you can use the static import:

//use static import like this :
using static MST.Tools.ConsoleHelper;

class Program
{
    static void Main()
    {
        // and you can use methods without typing 'ConsoleHelper.' every time
        Ok("Data saved correctly.");
        Fail("Failed to connect to server.");
        Warn("Low disk space.");
        Info("Loading configuration...");
    }
}

🎨 Theming

You can fully customize colors with RGB values (0-255) or hex codes (#RRGGBB).

using static MST.Tools.ConsoleHelper;

class Program
{
    static void Main()
    {
        //you can set theme colors in hex format or R,G,B format
        SetTheme("#2DC653", "#A0A0A0", "#FFD23F");
    }
}

Reset theme back to default:

ResetTheme();

Set error color:

SetErrorColor("255,0,0");

πŸ“‹ UI Helpers

Sections and Dividers

Section("User Menu");
Divider();
MenuItem(1, "Start Application");
MenuItem(2, "Settings");
MenuItem(3, "Exit");

Results and Items

PrintResult("Username", "MST");
ShowItem(42, "Special Item");

Customizing Outputs

you can override the default theme colors for UI elements on a per-call basis to draw attention to important information.

Here is a combined example showing how you can use these customizations together to build a richer UI:

Section("System Diagnostics");
Info("Choose a system to check:");

// Highlight the "Network" option which requires attention
MenuItem(1, "CPU");
MenuItem(2, "Memory");
MenuItem(
    number: 3,
    text: "Network (High Latency Detected)",
    numberFg: "#FFB300", // Gold
    textFg: "255,215,0"  // Lighter Gold
);

// Show a result with custom colors to indicate a warning status
PrintResult(
    label: "Overall Status",
    result: "Action Required",
    labelFg: "#D3D3D3",   // Light Gray
    valueFg: "#FFA500"   // Orange
);

// List critical processes and highlight one that has stalled
Info("Running critical processes:");
ShowItem(2041, "system.core.service");
ShowItem(
    id: 3155,
    item: "data.backup.agent (Stalled)",
    idFg: "#FF6347",      // Tomato Red
    itemFg: "#FF8C00"     // Dark Orange
);

⌨️ Input Helpers

Simple Input

string name = GetInput("Enter your name:");

Integer Input

int age = GetIntInput("Enter your age:");

Decimal Input

decimal price = GetDecimalInput("Enter product price:");

Customizing Input Prompts

By default, input prompts use the theme's Secondary color for the label (the prompt text) and the Primary color for the input symbol (➜). You can easily override these on a per-call basis using the labelFg and cursorFg parameters. This allows for creating visually distinct prompts for different questions without changing the global theme.

Here is a complete example demonstrating all parameters for GetIntInput:

int specialNumber = GetIntInput(
    prompt: "Enter a special number between 40 and 50",
    min: 40,
    max: 50,
    labelFg: "#9370DB", // A custom purple color for the label
    cursorFg: "#FFD700"  // A custom gold color for the arrow
);

Ok($"Success! Your special number is: {specialNumber}");

// The same customization can be applied to GetInput and GetDecimalInput.
string reason = GetInput(
    prompt: "Why did you choose this number?",
    labelFg: "173, 216, 230" // Light Blue
);

Confirm / Exit

if (Confirm("Do you want to continue?"))
{
    Ok("Confirmed!");
}

if (ExitOption())
{
    Fail("Exiting program...");
}

βœ… Example Output

βœ” Operation completed successfully!
βœ– Something went wrong!
➜ Loading configuration...

βš™οΈ Advanced Configuration

If you're running the application in an environment that doesn't support Unicode symbols (like older Windows cmd.exe), you can force an ASCII-only symbol set.

// Force ASCII symbols like "[OK]" and "[X]" instead of "βœ”" and "βœ–"
SetSymbolSet(SymbolSet.Ascii);

Ok("This will now be prefixed with [OK].");

πŸ“ License

MIT License Β© 2025 MST.Tools

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 was computed.  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 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net6.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
0.3.1 131 8/20/2025
0.3.0 135 8/11/2025
0.0.1 105 7/31/2025