dluc / DL.PrettyText.NET

Text manipulation, JSON formatting, Console colors etc.

Home Page:https://dev.ai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DL.PrettyText

C# utils to

  • Format JSON with colors
  • Change system console colors
  • Print colored text to the system console.

Nuget package

Package available at nuget.org/packages/DL.PrettyText.NET

Screenshots

Example on console with black background

Example on console with white background

API

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)

About

Text manipulation, JSON formatting, Console colors etc.

https://dev.ai/

License:Other


Languages

Language:C# 100.0%