I don't have enough rep to comment on
user unknown, so here:
(note: a lot of them usually don't work, but most of these are marked thus.)
I'm making a game in the terminal and have been relying heavily on the above link. It even tells you how to hide/unhide the cursor, make color (30's), "bold" (lighter), darker, underlined, italic, background color (40's instead of 30's), etc. You can also change the cursor's location (which is very helpful - for example,
"\x1B[1A" moves the cursor up one line;
"\x1B[0;0H" moves the cursor to row 0, col 0;
"\x1B[2J" clears the screen;
"\x1B[2K" clears the line.
For your purposes as people have said:
echo -e "\x1b[30;44m black with blue background \x1b[m"
echo -e "\x1b[31;42m red with green background \x1b[m"
echo -e "\x1b[32;40m green with black background \x1b[m"
echo -e "\x1b[8m Invisible; na na na na boo boo \x1b[m"
Note: You need the
echo **-e** "\x1b[35;1m Light purple \x1b[m"
or you need to use single quotes. Type
man echo to see why (double quotes are usually a pain when printing; when I need stuff to not expand or I need ANSI escape sequences, I use single quotes because it is easy - even though I gotten used to it from doing it so many times - to forget the -e in which case you get "
box with numbers and letters[35;1m").
Every time you see
CSI replace it with
"\x1b[" I think is more standard, but I don't really know what the difference is between them is.