Crayon
๐ Paint your console from .NET
Install / Use
/learn @riezebosch/CrayonREADME
๐ Crayon
An easy peasy tiny library for coloring console output in inline strings using ANSI escape codes.
V2
The API has changed to support background colors.
I dropped the extension methods on string and opted for the using static directive instead.
All methods now have an overload for direct input so you no longer have to end with a Text() invocation.
Examples
using static Crayon.Output;
Console.WriteLine(Green($"green {Red($"{Bold("bold")} red")} green"));
Console.WriteLine(Bright.Blue($"Bright {Green("and normal green")}"));
Console.WriteLine(Bold().Green().Text($"starting green {Red("then red")} must be green again"));

Colors
Black()
Red()
Green()
Yellow()
Blue()
Magenta()
Cyan()
White()
Rgb(r, g, b)
Background.Blue()
Bright.Blue()
Decorations
Bold()
Dim()
Underline()
Reversed()
Text
Blue().Underline().Text("input")
Blue().Underline("input")
All colors and decorations have an overload with direct input and terminating the formatter.
Rainbows ๐
Thanks to DevinR528 we now have rainbows!
var rainbow = new Rainbow(0.5);
for(var i = 0; i < 15; i++)
{
Console.WriteLine(rainbow.Next().Bold().Text("rainbow"));
}
How compatible is it?
It works fine on everything except for older Windows versions.
Credits
My journey for using ANSI codes in C# first brought me here: https://www.jerriepelser.com/blog/using-ansi-color-codes-in-net-console-apps/
The ANSI coloring details was inspired by this blog post: http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
The code for enabling ANSI colors feature on Windows was borrowed from this issue: https://github.com/Microsoft/WSL/issues/1873
No greater compliment than someone taking your work for inspiration. In return I peaked into his code for the RGB support!
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot ๅฏๅชไฝๆถๅ่ฝๅใไฝฟ็จ <qqmedia> ๆ ็ญพ๏ผ็ณป็ปๆ นๆฎๆไปถๆฉๅฑๅ่ชๅจ่ฏๅซ็ฑปๅ๏ผๅพ็/่ฏญ้ณ/่ง้ข/ๆไปถ๏ผใ
