Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement