Skip to content

Writing Console Apps with DotNet in 2022 - Part 1 - Crayon

Photo by <a href="">Veronica Lorine</a>
Photo by Veronica Lorine

This blog is part of a series of blog posts looking at .Net packages to help .Net Developers create console apps.


A few months ago, I saw Evan You demo Vite. One thing in the demo I noticed were the options displayed in Coloured Text in the Console Window.

Initially dismissing this as a feature unique to Mac Os. I wanted to know if this was possible in a .Net Console App.


Crayon is a .NET Package written by Manuel Riezebosch.

Its available on Github -

and on Nuget -

Getting Started

With Crayon installed, You have methods to style the Text.

So you can put

using static Crayon.Output;

Console.Write(Red("All I see is Red !!!!"));

Which displays

Red text example

Now this is possible with Colour Commands already built into the Framework, but Crayon allows you to pass RGB Values, extending the colour palette.

using static Crayon.Output;

Console.Write(" and ");
Console.Write(Rgb(255, 255, 100).Text("Yellow"));
Console.Write(Bold(" and "));
Console.Write(Bold(Rgb(255,192,203 ).Text("Pink")));
Console.Write(" and ");

Console.Write(Rgb(191, 64, 191).Text("Purple"));
Console.Write(" and ");
Console.Write(Rgb(255, 191, 0).Text("Orange"));
Console.Write(Bold(" and "));
Console.Write("I can sing a ");
Console.Write(Rgb(255, 191, 0).Text("a"));
Console.Write(Rgb(255, 255, 100).Text("i"));
Console.Write(Rgb(75, 01, 130).Text("o"));
Console.WriteLine(Rgb(238, 130, 238).Text("w"));

Which displays

Colour text example 1

Comes in Colours Everywhere

There is even a built in Rainbow Class

var rainbow = new Rainbow(0.5);
string testStr = "  Somewhere over the rainbow, way up high\n\r  " +
                 "There's a land that I heard of once in a lullaby\n\r\n\r";
foreach (char c in testStr)
            ? c.ToString() : rainbow.Next().Bold().Text(c.ToString()));

All of this runs perfectly on Windows Terminal

Colour text Window Terminal example

and also via WSL, here is an example of the above code on Ubuntu.

Colour text Ubuntu example

So If you want a more Colourful Console output, Then check out Crayon and if you like it Please consider giving the Repo a Github star.

Posted in Writing Console Apps with DotNet in 2022