ColorizedConsole 1.0.0
dotnet add package ColorizedConsole --version 1.0.0
NuGet\Install-Package ColorizedConsole -Version 1.0.0
<PackageReference Include="ColorizedConsole" Version="1.0.0" />
<PackageVersion Include="ColorizedConsole" Version="1.0.0" />
<PackageReference Include="ColorizedConsole" />
paket add ColorizedConsole --version 1.0.0
#r "nuget: ColorizedConsole, 1.0.0"
#:package ColorizedConsole@1.0.0
#addin nuget:?package=ColorizedConsole&version=1.0.0
#tool nuget:?package=ColorizedConsole&version=1.0.0
ColorizedConsole
ColorizedConsole is a simple, lightweight wrapper for System.Console that adds basic, configurable coloring functionality to your console apps.
Features
Complete wrapper for
System.Console, so it can be used as a replacement and you can use the same class for all of your console output.Multiplatform -- uses no
DllImportor other external calls. Basically, it has the same platform limitations asSystem.Console.Lightweight -- uses no external libraries or NuGet packages. Even the configuration system was custom-built since it's so simple (see below).
Installation
ColorizedConsole is available via NuGet.
# Using powershell
Install-Package ColorizedConsole
... or...
# Using the .NET CLI
dotnet add package ColorizedConsole
... or any of the other ways you can get a NuGet package.
Usage
There is one class in the package: ColorEx. It provides three types of colorized text: Debug, Info, and Error. Each is provided in a Write and WriteLine form, and all of them have the same parameters and overloads as the standard Console.Write and Console.WriteLine methods. The colors for all three types are customizable (see below).
WriteDebug
By default, this text is <code style="color: Yellow">yellow</code>.
ColorizedConsole.ConsoleEx.WriteDebug("some_text");
ColorizedConsole.ConsoleEx.WriteDebugLine("some_text");
WriteInfo
By default, this text is <code style="color: Green">green</code>.
ColorizedConsole.ConsoleEx.WriteInfo("some_text");
ColorizedConsole.ConsoleEx.WriteInfoLine("some_text");
WriteError
By default, this text is <code style="color: Red">red</code>.
ColorizedConsole.ConsoleEx.WriteError("some_text");
ColorizedConsole.ConsoleEx.WriteErrorLine("some_text");
In addition, every overload for Console.Write and Console.WriteLine has a version that supports color. For example:
ColorizedConsole.ConsoleEx.WriteLine(ConsoleColor.Purple, 6);
Configuration
Configuration is done using a file called .colorcrc. This was done to avoid the need for other dependencies or NuGet packages like Microsoft.Extensions.Configuration.
The format of this file is very simple:
Info=[value]
Debug=[value]
Error=[value]
value must be a valid member of the ConsoleColor enumeration. If it is not, ConsoleEx will fall back to whatever the system's default colors are for the console.
Put that file in the same location as your .exe, and away you go!
Contributions
Want to contribute? Fantastic! I'd be happy for the help to make this even more useful, provided the following project goals are maintained:
Complete
System.Consolewrapper including all overloads to allowColorizedConsole.ConsoleExto be a drop-in replacement.Multiplatform (as much as the system version is) by not using platform-specific calls such as
DllImport.Standalone and lightweight by not being dependent on anything other than the base CLR itself.
You're welcome to request access to the project or fork it and create a PR. Or just contact Merovech. Whatever works for you.
| 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
- 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.0.0 | 230 | 9/19/2024 |
Initial release.