Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.82 KB

README.md

File metadata and controls

38 lines (33 loc) · 1.82 KB

Output Colorizer

NuGet version Nuget downloads Build And Test codecov MIT License

Colorize your output with this simple to use and extensible library

Download

This is available as a Nuget package and you can use it in your Desktop for .NET Core application.

Syntax

Colorizer.WriteLine("[<color>!<text>]");
  • The segment that should be colored with a given color is included in [ and ].
  • The color is specified immediately after the [ and up to the ! character.
  • After the ! character is the text to rended in that color
  • {0} syntax for parameters is supported
  • Segments can be nested together for greater flexibility

Examples

// Simple pattern
Colorizer.WriteLine("[Green!Hello world!]"); 
// You can nest colors
Colorizer.WriteLine("[Green!Green. And [Yellow!Yellow] then green.]"); 
// You can use parameters
Colorizer.WriteLine("[Green!Hello {0}]", "world"); 
// And can use them without restriction
Colorizer.WriteLine("[Green!Hello {1}, this is [Yellow!{0}]]", "me", "world"); 
 // And you can use string interpolation
string s1 = "me", s2 = "world";
Colorizer.WriteLine($"[{ConsoleColor.Red}!Hello {s2}, this is [Cyan!{s1}]]");