Advertisement
Guest User

Untitled

a guest
May 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const char esc = (char)0x1b;
  2.  
  3. // not all terms support this; in case not, a muxer like tmux or screen will approximate it
  4. public string TrueColorEscaped(string obj, int r, int g, int b) {
  5. // <ESC>[38;2;{r};{g};{b}m sets a true color color
  6. // <ESC>[0m resets color
  7. return String.Format("{0}[38;2;{1};{2};{3}m{4}{0}[0m", esc, r, g, b, obj);
  8. }
  9.  
  10. foreach (var i in Enumerable.Range(0, 255))
  11. Console.WriteLine(TrueColorEscaped("Hello world", i, 0, 0));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement