Color space tools
- Transform between RGB and HSL color spaces.
- Convert among hex, int, (byte r, byte g, byte b), (float h, float s, float l) and System.Drawing.Color.
- Applicable to styles: Bold, Italic, Underline, and Inverse.
- Render an array or 2d-array of number into colored based on the relative value of each number.
Package | Content |
---|---|
Palett |
The core library, including all Palett sub projects |
Palett.Cards |
Preset color cards with 14 degrees of color gradients |
Palett.Convert |
Convert colors among hex / int / rgb / hsl / Color |
Palett.Deco |
Render terminal string color |
Palett.Dye |
Colorant (factory) for terminal string |
Palett.Fluos |
Colorize array and 2d-array in terminal |
Palett.Presets |
Preset color range |
Palett.Projector |
Project a number to colored based on a range |
Palett.Types |
Base types in Palett series |
Palett.Utils |
Base static params of ANSI values |
Palett targets .NET Standard 2.0, suitable for .NET and .NET Framework.
Install Palett package and its dependencies.
NuGet Package Manager:
Install-Package Palett
.NET CLI:
dotnet add package Palett
All versions can be found on nuget.
using Palett.Convert;
// using RGB = System.ValueTuple<byte, byte, byte>;
// using HSL = System.ValueTuple<float, float, float>;
(byte, byte, byte) rgb = (242, 114, 69);
var hsl = rgb.RgbToHsl();
var hex = hsl.HslToHex();
var rgb2 = Conv.HexToRgb(hex);
var int = rgb2.RgbToInt();
using Palett;
using Palett.Fluos;
var samples = new[] { "foo", "bar", "zen", "16", "24", "32", "64" };
var colored = samples.Fluo(Presets.Planet);
Palett has a test suite in the test project.
Palett is licensed under the MIT license.
Bug report and contribution are welcome at the GitHub repository.