PastelEx 1.0.3
See the version list below for details.
dotnet add package PastelEx --version 1.0.3
NuGet\Install-Package PastelEx -Version 1.0.3
<PackageReference Include="PastelEx" Version="1.0.3" />
paket add PastelEx --version 1.0.3
#r "nuget: PastelEx, 1.0.3"
// Install PastelEx as a Cake Addin #addin nuget:?package=PastelEx&version=1.0.3 // Install PastelEx as a Cake Tool #tool nuget:?package=PastelEx&version=1.0.3
β οΈ API has changed a bit in this version (1.0.2)! One of changes are methods
Pastel()
,PastelBg()
andPastelDeco()
, they are now justFg
,Bg
andDeco
. Old methods will be removed in future, please switch to the new methods!
PastelEx π₯
Elevate Your Console Output with Colors and Styles
Inspired by the syntax of Pastel and Crayon. PastelEx wouldn't exist without these incredible libraries.
Tested and Compatible with Windows and Linux terminals.
π¨ Inspiration
Adding ANSI color codes can be a confusing and challenging task to do manually. PastelEx simplifies the process of coloring and styling console output.
βοΈ How It Works
Using a simple syntax, like "Hello, World!".Fg(Color.White)
, wraps your string in a special Unicode character sequence that instructs the terminal to apply color. This library offers benefits such as ease of use and automatic checks for terminal ANSI color support.
π₯ Example:
using PastelExtended;
using System.Drawing;
Console.WriteLine($"Look, this text is {"colored".Fg("#ffff00")}!".Fg(Color.White));
Console.WriteLine(PastelEx.Gradient("And this one is gradient!", new[] { Color.Magenta, Color.Aqua }));
β‘ Performance Benefits
PastelEx efficiently enhances console output without excessive memory allocation. The library performs exceptionally well in comparison to alternatives.
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 |
π§ͺ Tested and Verified
PastelEx is rigorously tested to ensure accurate and intended color and style rendering. It dynamically checks and adapts to your terminal's ANSI color support, providing a seamless experience.
Note: Avoid explicit calls to PastelEx.Enable()
. PastelEx handles ANSI color code display automatically.
π« NO_COLOR Compatibility
PastelEx respects the NO_COLOR
environment variable. If set, it disables color output to accommodate user preferences.
π§ What PastelEx Doesn't Offer
While PastelEx empowers your console output, it doesn't provide tools for creating complex Console UI, panels, or tables.
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.
New methods and properties (and simplified method names)!
NOTE: Old methods are marked as obsolete now.