PastelEx 1.0.4
dotnet add package PastelEx --version 1.0.4
NuGet\Install-Package PastelEx -Version 1.0.4
<PackageReference Include="PastelEx" Version="1.0.4" />
paket add PastelEx --version 1.0.4
#r "nuget: PastelEx, 1.0.4"
// Install PastelEx as a Cake Addin #addin nuget:?package=PastelEx&version=1.0.4 // Install PastelEx as a Cake Tool #tool nuget:?package=PastelEx&version=1.0.4
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!
π¨ Inspiration
This library simplifies the process of applying ANSI color codes to strings, mitigating several potential drawbacks:
- If a terminal lacks ANSI support, the output might display the string with visible ANSI codes, as the terminal wouldn't recognize them as formatting instructions.
- Manually composing ANSI codes can be intricate for humans, involving the need to write out each code explicitly.
βοΈ How It Works
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.
β When to Use
For adding color or decoration in small console apps.
π« NO_COLOR Compatibility
Respects the NO_COLOR
environment variable. If this variable exists with any value, colors and decorations will be disabled by default.
π§ͺ Tested
Tested for accurate rendering. If you find any issues, please report them via the issues page.
β‘ Performance
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 |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.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.
Check the changelog on the github for latest changes.