Disclaimer: This library only works on Linux & MacOS currently. Alpha builds are subject to change.
Use string formatting/interpolation while calling Printer.Write()
or Printer.WriteLine()
to print with colors! Color properties are stored in the Clr
class , formatting properties are in the Frmt
class, and background color properties are in the Bkgrd
class. To reset all color/formatting changes, use the Reset.Code
property or call the Reset.All()
class method.
Get this library off of Nuget!
Printer.SayHello();
Clr.SetCyan();
Printer.WriteLine($"This library uses {Frmt.Bold}Shell.NET!");
Reset.All();
Printer.WriteLine(string.Format("{0}{4}C#{5} in {2}{4}Linux{5} is pretty {3}{4}cool!{5}",
Clr.Magenta,
Clr.White,
Clr.Green,
Clr.Yellow,
Frmt.Bold,
Reset.Code
));
Note: Remember to use Reset.All() to return back to default colors.
- Clr.Default
- Clr.Black
- Clr.White
- Clr.Red
- Clr.Green
- Clr.Yellow
- Clr.Blue
- Clr.Magenta
- Clr.Cyan
- Clr.LtGray
- Clr.DrkGray
- Clr.LtRed
- Clr.LtGreen
- Clr.LtYellow
- Clr.LtBlue
- Clr.LtMagenta
- Clr.LtCyan
Note: All color properties have a corresponding class method. Examples:
- Clr.SetBlue()
- Clr.SetDefault()
- Frmt.Bold
- Frmt.Dim
- Frmt.Underline
- Frmt.Invert
- Frmt.Hidden
- Frmt.UnBold
- Frmt.UnDim
- Frmt.UnUnderline
- Frmt.UnInvert
- Frmt.UnHidden
Note: All formatting properties have corresponding activation and deactivation class methods. Examples:
- Frmt.SetDim()
- Frmt.ResetDim()
- Frmt.Underline()
- Frmt.ResetAll()
- Reset.Code
- Reset.All()
Same colors as the Clr class; contained in the Bkgrd class. Examples:
- Bkgrd.LtGray
- Bkgrd.White
- Bkgrd.SetBlue()
- Bkgrd.SetDefault()