itbXLib 2.0.0
dotnet add package itbXLib --version 2.0.0
NuGet\Install-Package itbXLib -Version 2.0.0
<PackageReference Include="itbXLib" Version="2.0.0" />
<PackageVersion Include="itbXLib" Version="2.0.0" />
<PackageReference Include="itbXLib" />
paket add itbXLib --version 2.0.0
#r "nuget: itbXLib, 2.0.0"
#:package itbXLib@2.0.0
#addin nuget:?package=itbXLib&version=2.0.0
#tool nuget:?package=itbXLib&version=2.0.0
itbXLib
A .NET helper library for console applications used in educational projects at ITecBCN.
Features 🌟
- Terminal color helpers with RGB and HEX to ANSI conversion
- Text styles (bold, italic/cursive, underline, and combined styles)
- Emoji helpers for UTF-8 output and Unicode code point conversion
- Runtime terminal capability detection with safe fallback to plain output
- Generic validated input helper for reusable parsing and validation
Installation 📥
.NET CLI
dotnet add package itbXLib
Package Manager Console
Install-Package itbXLib
PackageReference
<PackageReference Include="itbXLib" Version="*" />
Usage 💠
All public utilities are under:
using itbXLib.TerminalUtils;
Colors
string red = Colors.RgbToAnsi("#FF0000");
Console.WriteLine($"{red}Error message{Colors.Reset}");
string custom = Colors.RgbToAnsi(30, 144, 255);
Console.WriteLine($"{custom}Info message{Colors.Reset}");
Styled text and emoji
Styles.EnableEmojiSupport();
Console.WriteLine(Styles.Bold("Bold text"));
Console.WriteLine(Styles.Italic("Italic text"));
Console.WriteLine(Styles.Underline("Underlined text"));
Console.WriteLine(Styles.BoldItalicUnderline("Strong emphasis"));
string rocket = Styles.FromCodePoint(0x1F680);
Console.WriteLine(Styles.WithEmoji(rocket, "Launch ready"));
ConsoleHelper output
ConsoleHelper.ColorWriteLine("Success", ConsoleColor.Green);
ConsoleHelper.ColorWriteLine("HEX message", "#22C55E");
ConsoleHelper.HeaderSeparator("My App");
Generic input validation
int age = GenericInputs<int>.Read(
"Enter age: ",
"Please enter a valid non-negative integer.",
input =>
{
bool ok = int.TryParse(input, out int value) && value >= 0;
return (ok, value);
},
ConsoleColor.Cyan
);
Terminal compatibility behavior
TerminalCapabilities is used internally by color/style helpers:
- It auto-detects ANSI/styling support the first time styling is used
- If unsupported, it prints a one-time warning to
Console.Error - Styling is disabled for that runtime and output falls back to plain text
- You can override detection manually with
TerminalCapabilities.ForceSet(bool)
Example:
TerminalCapabilities.Detect();
if (!TerminalCapabilities.StylingEnabled)
{
Console.WriteLine("Running in plain output mode.");
}
API reference (current)
itbXLib.TerminalUtils.ColorsRgbToAnsi(int r, int g, int b)RgbToAnsi(string hex)Reset
itbXLib.TerminalUtils.StylesBold(string)Italic(string)Underline(string)BoldItalicUnderline(string)EnableEmojiSupport()FromCodePoint(int)WithEmoji(string emoji, string label)
itbXLib.TerminalUtils.ConsoleHelperColorWrite(...),ColorWriteLine(...),HeaderSeparator(string)
itbXLib.TerminalUtils.GenericInputs<T>Read(string message, string errorMessage, Func<string, (bool isValid, T value)> validator, ConsoleColor? color = null)
itbXLib.TerminalUtils.TerminalCapabilitiesStylingEnabledDetect()ForceSet(bool)
Notes on deprecated APIs
Deprecated members are intentionally omitted from this README. For new code, use GenericInputs<T> for input workflows and the itbXLib.TerminalUtils namespace for all terminal helpers.
Building from source
git clone https://github.com/x341dev/itbXLib.git
cd itbXLib
dotnet build
Contributing
Contributions are widely appreciated! If you want to help out, please follow these steps:
- Fork the repository
- Create a branch (
git checkout -b feature/my-change) - Commit using conventional commits
- Push and open a pull request
Changelog
See CHANGELOG.md for release history.
Made with ❤️ from Barcelona. x341dev - GitHub
| Product | Versions 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. 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. |
-
net8.0
- MongoDB.Driver (>= 3.8.0)
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 |
|---|---|---|
| 2.0.0 | 87 | 5/13/2026 |
| 1.5.1 | 97 | 5/11/2026 |
| 1.4.1 | 99 | 4/13/2026 |
| 1.4.0 | 94 | 4/10/2026 |
| 1.3.6 | 104 | 4/7/2026 |
| 1.3.1 | 103 | 4/6/2026 |
| 1.3.0 | 102 | 4/6/2026 |
| 1.2.0 | 141 | 3/23/2026 |
| 1.1.0 | 119 | 3/2/2026 |
| 1.0.0 | 135 | 2/24/2026 |
| 0.2.1 | 178 | 2/9/2026 |
| 0.2.0 | 174 | 2/5/2026 |
| 0.1.2 | 181 | 1/29/2026 |
| 0.1.1 | 177 | 1/29/2026 |
| 0.1.0 | 179 | 1/29/2026 |