C# utils to
- Format JSON with colors
- Change system console colors
- Print colored text to the system console.
Package available at nuget.org/packages/DL.PrettyText.NET
Serialize an object to JSON and format the JSON with indentation:
string text = JsonFormatter.Format(object obj, ushort indentation = 4)
Format a JSON string with indentation:
string text = JsonFormatter.Format(string json, ushort indent = 4)
Minify a JSON string:
string text = JsonFormatter.Minify(string json)
Print an object to console using JSON notation and colors, either on black or white background:
Console.PrintJson(object obj, ushort indentation = 4, bool blackBg = true)
Print a JSON string to console using colors, either on black or white background:
Console.PrintJson(string json, ushort indentation = 4, bool blackBg = true)
Change the default foreground (Gray) and background (Black) console colors to new values:
ConsoleColors.ChangeScreenColors(System.Drawing.Color foreground, System.Drawing.Color background)
Change one of the 16 console colors, to match one of the many colors available in System.Drawing:
ConsoleColors.RedefineColor(System.ConsoleColor consoleColor, System.Drawing.Color targetColor)
Change one of the 16 console colors, to new RGB values:
ConsoleColors.RedefineColor(System.ConsoleColor consoleColor, uint red, uint green, uint blue)