Unfortunately, the .NET core does not have the ability for professional color schemes, and it was fun to play with ANSI. The result was this package
dotnet add package ConsoleRGBColors --version 1.0.2
You can clone the repo and build the package dll file with the following commands:
git clone [email protected]:AmirMahdyJebreily/ConsoleRGBColors.git &&
cd ConsoleRGBColors &&
dotnet build -c Release
Now you can go to your console project and add the generated dll file to the references:
dotnet add app/app.csproj reference path/to/the/dll/file/ConsoleRGBColors.dll
To use ConsoleRGBColors, you must first add the following namespace:
using ConsoleRGBColors;
Now you able to change ForeColor or BackColor of any string in any part of the text:
Console.WriteLine($"Test {"Color".ChangeStringForeColor(255,71,71)}");
Console.WriteLine($"Test {"Color".ChangeStringBackColor(255,71,71)}");
Also you can use css default colors which in Color
struct like this :
Console.WriteLine($"Use Css {"Color".ChangeStringForeColor(Color.Chocolate)}");
To print a gradient use this codes:
// Vertical Gradient
ConsoleRGBColors.RGBConsole.PrintVerticalGradiant(text, (101, 78, 163), (234, 175, 200));
// Horizontal Gradient
ConsoleRGBColors.RGBConsole.PrintHorizontalGradiant(text, (0, 159, 255), (236, 47, 75));
Fo more information about using, see the Test
thank you for star this project and submit issues in github ❤️