AnsiStyles 1.0.0
See the version list below for details.
dotnet add package AnsiStyles --version 1.0.0
NuGet\Install-Package AnsiStyles -Version 1.0.0
<PackageReference Include="AnsiStyles" Version="1.0.0" />
paket add AnsiStyles --version 1.0.0
#r "nuget: AnsiStyles, 1.0.0"
// Install AnsiStyles as a Cake Addin #addin nuget:?package=AnsiStyles&version=1.0.0 // Install AnsiStyles as a Cake Tool #tool nuget:?package=AnsiStyles&version=1.0.0
AnsiStyles
Lightweight, simple library that provides an easy and intuitive way for adding color to your console applications, allowing you to add multiple different colors and styles to the same string variable.
Comes with 256 colors and 4 font styles for both background and foreground.
Usage
Here's a simple code demonstrating all you need to know about the intended use case of this library.
var rs = StringStyle.Reset;
var fc = StringStyle.Foreground;
var prpl = fc[129];
string text = $"This is {prpl}purple{rs} and this is {fc[196]}red{rs}";
Console.WriteLine(text); //Will print out 'text' with purple and red colored
//Can also use some ANSI code for styling
var boBlue = fc[21].Bold().Outline();
Console.WriteLine(fc[70].Faint() + "some text" + $"{boBlue} bold outlined blue{rs}");
//You can also concat it with regular strings
var text2 = fc.Yellow + "This is yellow " + rs + prpl + "and this is purple";
Console.WriteLine(text2);
Console.WriteLine("Look, i'm still purple!");
Console.WriteLine(rs); //Remember to always apply reset to the end of the strings
Console.WriteLine("i'm normal now!"); //Or you can just print the reset out, else the applied color/style
//will keep bleading in subsequent prints until it finds a reset
//All of the above but for the background of the string
var bc = StringStyle.Background;
Console.WriteLine(bc.White + fc.Black + "Black text with White highlighting" + rs);
fc.ColorTest(); //prints out all the available colors codes
bc.ColorTest();
Contributing
Feel free to contribute
- Just fork and clone the repository
- Then commit and pull request only for the
dev
branch.
Support
- If you encouter a bug or would like to request a feature, please submit an issue.
- For any other question that is not related to bugs or feature, feel free to contact me.
AnsiStyles is released under BSD 3-Clause license
Contact me
Email: gashimabucoro@proton.me · Discord: @.haise_san
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.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.1 | 156 | 2/15/2024 |
1.0.0 | 117 | 2/15/2024 |
0.1.0-beta | 113 | 2/13/2024 |
First release, if you have any problems, please feel free to contact me.