Created
May 6, 2016 12:51
-
-
Save NattyNarwhal/93764669ded3851e7a691f1304e29fc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const char esc = (char)0x1b; | |
// not all terms support this; in case not, a muxer like tmux or screen will approximate it | |
public string TrueColorEscaped(string obj, int r, int g, int b) { | |
// <ESC>[38;2;{r};{g};{b}m sets a true color color | |
// <ESC>[0m resets color | |
return String.Format("{0}[38;2;{1};{2};{3}m{4}{0}[0m", esc, r, g, b, obj); | |
} | |
foreach (var i in Enumerable.Range(0, 255)) | |
Console.WriteLine(TrueColorEscaped("Hello world", i, 0, 0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment