YonatanMankovich.SimpleColorConsole
1.0.1
dotnet add package YonatanMankovich.SimpleColorConsole --version 1.0.1
NuGet\Install-Package YonatanMankovich.SimpleColorConsole -Version 1.0.1
<PackageReference Include="YonatanMankovich.SimpleColorConsole" Version="1.0.1" />
<PackageVersion Include="YonatanMankovich.SimpleColorConsole" Version="1.0.1" />
<PackageReference Include="YonatanMankovich.SimpleColorConsole" />
paket add YonatanMankovich.SimpleColorConsole --version 1.0.1
#r "nuget: YonatanMankovich.SimpleColorConsole, 1.0.1"
#:package YonatanMankovich.SimpleColorConsole@1.0.1
#addin nuget:?package=YonatanMankovich.SimpleColorConsole&version=1.0.1
#tool nuget:?package=YonatanMankovich.SimpleColorConsole&version=1.0.1
Simple Color Console
An easier way to create, edit, and write colorful text to the console.
The NuGet package is available here.
Getting Started Examples
Multiple ways to do the same thing:
using YonatanMankovich.SimpleColorConsole;
"Hello world!".TextBlack().BackYellow().WriteLine();
"Hello world!".Color(ConsoleColor.Black, ConsoleColor.Yellow).WriteLine();
"Hello world!".ColorText(ConsoleColor.Black).ColorBack(ConsoleColor.Yellow).WriteLine();
ColorConsole.WriteLine("Hello world!".TextBlack().BackYellow());
ColorConsole.WriteLine("Hello world!", ConsoleColor.Black, ConsoleColor.Yellow);
new ColorString("Hello world!", ConsoleColor.Black, ConsoleColor.Yellow).WriteLine();
See a list of available colors at the end.
ColorString Features
using YonatanMankovich.SimpleColorConsole;
ColorString cs = "Hello world!".TextBlack().BackYellow();
cs.Write(); // Write the ConsoleString to the console.
cs.WriteLine(); // Write the ConsoleString to the console and adds a new line.
cs.WriteAtPoint(new Point(6, 9)); // Write the ConsoleString to the console at the specified point.
ColorChar cc = cs[5]; // Get the ColorChar at an index.
cs[4].BackYellow(); // Set the ColorChar at an index.
cs.AddToEnd(new ConsoleChar('!', ConsoleColor.Blue, ConsoleColor.Green)); // Add a ConsoleChar to end.
cs.AddToEnd(' '); // Add a plain char to end.
cs.AddToEnd(new ConsoleString("Yo! ", ConsoleColor.Blue, ConsoleColor.Magenta)); // Add a ConsoleString to end.
cs.AddToEnd("Boom!"); // Add a plain string to end.
cs.AddToEnd("Very".BackBlue()).AddToEnd(' '.BackYellow()).AddToEnd("nice!"); // Chain calls.
ColorString concat1 = cs + " Cool!"; // Concatenate a plain string (or char).
ColorString concat2 = cs + " Cool!".TextYellow(); // Concatenate a ColorString string (or ColorChar).
foreach (ColorChar c in cs) c.Write(); // Enumerate the ColorChars of a ColorString.
ColorLines for Multi-Line ColorStrings
ColorLines is a collection of lines of type ColorString. It generally has the same features as ConsoleStrings. The following are the only additions:
using YonatanMankovich.SimpleColorConsole;
ColorLines cl = new ColorLines();
cl.AddLine("Hello!".TextGreen()); // Add a ColorString/string/ColorChar/char line.
cl.AddLine(); // Add a blank line.
cl.AddLine().AddLine("Hello!".TextCyan()); // Chain calls.
cl.AddToEndOfLastLine("OK".BackRed()); // Add a ColorString/string/ColorChar/char to the end of the last line.
Behavioral Notes
'/n','/r','/t'are not allowed. If a multi-line string is needed, useColorLines.- If the background color is not specified, the current
Console.BackgroundColoris used. - If the text color is not specified, the current
Console.ForegroundColoris used.
Available Colors
- Black
- DarkBlue
- DarkGreen
- DarkCyan
- DarkRed
- DarkMagenta
- DarkYellow
- Gray
- DarkGray
- Blue
- Green
- Cyan
- Red
- Magenta
- Yellow
- White
(List from here)
My Other Projects That Use This Library
| Product | Versions 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 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. |
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on YonatanMankovich.SimpleColorConsole:
| Package | Downloads |
|---|---|
|
YonatanMankovich.ConsoleDiffWriter
A library that helps keep track of text written to the console and efficiently writes only the difference with the updated text instead of rewriting all of it. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 486 | 4/8/2023 |
Bug fix.