PastelEx 1.0.4

dotnet add package PastelEx --version 1.0.4                
NuGet\Install-Package PastelEx -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PastelEx" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PastelEx --version 1.0.4                
#r "nuget: PastelEx, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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


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  |

Example Image

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.0.4 538 8/31/2023
1.0.3 150 8/30/2023
1.0.2 181 8/12/2023
1.0.1 167 8/9/2023
1.0.0 174 8/8/2023

Check the changelog on the github for latest changes.