⚠ Deprecated: Legacy
PastelEx makes coloring console output easy! It’s a lightweight and extended version of Pastel.
$ dotnet add package PastelEx
Elevate Console Output with Colors and Styles
Simplify coloring console text with PastelEx, inspired by Pastel and Crayon.
Tested on Windows and Linux terminals. Download on nuget!
This library simplifies the process of applying ANSI color codes to strings, mitigating several potential drawbacks:
Example:
using PastelExtended;
using System.Drawing;
Console.WriteLine($"This text is {"yellow".Fg("#ffff00")}!".Fg(Color.White));
Console.WriteLine(PastelEx.Gradient("This text is gradient.", new[] { Color.Magenta, Color.Aqua }));
If needed or desired, you can modify PastelEx's behavior using the PastelSettings class.
To adjust the settings, simply modify the PastelEx.Settings property.
For adding color or decoration in small console apps.
Respects the NO_COLOR environment variable. If this variable exists with any value, colors and decorations will be disabled by default.
Tested for accurate rendering. If you find any issues, please report them via the issues page.
Efficient, minimal memory use.
Benchmark (lower values are better):
| Method | Mean | Gen 0 | Allocated |
|-----------|------------:|----------:|----------:|
| Pastel | 2,551.55 ns | 1.2665 | 2656 B |
| PastelEx | 25.78 ns | 0.0382 | 80 B |
| Crayon | 453.23 ns | 0.6266 | 1312 B |
