How to enable rgb colored output in terminal?

Posted by t.pimentel on Ask Ubuntu See other posts from Ask Ubuntu or by t.pimentel
Published on 2014-08-23T20:52:54Z Indexed on 2014/08/23 22:34 UTC
Read the original article Hit count: 283

Filed under:
|

I'm trying to print a colored string to a gnome-terminal using ANSI escape codes, but, although it works for the custom colors, or even the 256 extra color, it doesn't work with RGB codes.

So, simplifying:

cout << "\033[33m" << '.' << "\033[0m"; # prints with color
cout << "\033[38;5;135m" << '.' << "\033[0m"; # prints with color
cout << "\033[38;2;0;135;0m" << '.' << "\033[0m"; # doesn't work, prints with default color

How can I output something with an RGB color code in the gnome-terminal?

I'm following this link for outputs: Wikipedia ANSI escape code.

© Ask Ubuntu or respective owner

Related posts about gnome-terminal

Related posts about colors