Welcome! Log In Create A New Profile

Advanced

Console Background Color?

Posted by noob 
Console Background Color?
April 03, 2009 12:57AM
Can you change the console's background color?
Re: Console Background Color?
April 03, 2009 03:02AM
I dont think so, but dont quote me on that.
Re: Console Background Color?
April 04, 2009 04:09AM
You can change both foreground (text) and background colour by using VT escape sequences, but they are limited to a few colours. I also noticed that while you can change the text colour of a single word or letter without any problems multiple times in a string, you cannot do the same with background colours. I always ended up having the whole background painted in a single colour.

Anyway, you can use escape sequences in a simple printf or cout. The code below for example would change the text colour to yellow.
printf( "\x1b[33m" );
The same escape sequence can be used to change the background colour to yellow. You'd only have to change one attribute.
printf( "\x1b[43m" );
I'd suggest taking a look at this list of VT Escape Sequences to figure out which sequences might be useful to you and which attributes you can use. Note that not all of those might be supported by the Wii.



Edited 1 time(s). Last edit at 04/04/2009 04:10AM by Botskiz.
Re: Console Background Color?
April 04, 2009 05:20AM
Thanks you for the reply, it worked great except... it only changes the background of where text is and not the entire thing? Is that possible to do?
Re: Console Background Color?
April 04, 2009 05:24AM
You could do this in libogc by modifying the background color in console.c: con->background = COLOR_BLACK;

Then you have to compile/install libogc.
Re: Console Background Color?
April 04, 2009 05:42AM
Where do I find console.c? Beside I searched for it, found nothing. I got libogc already.



Edited 1 time(s). Last edit at 04/04/2009 06:10AM by noob.
Re: Console Background Color?
April 04, 2009 08:05AM
Do you have the source of libogc? If not you can find it here [sourceforge.net]
Re: Console Background Color?
June 30, 2009 03:01PM
I know this reply is like 3 months old but you can set the screen's bg color by setting the bg like you would for a line then clearing the screen. (so do it before you print anything)

printf("\x1b[2J"); //clears the screen




Now I have my own related question:
How in the heck do you make the text have NO background? I have an image in the background of the app and the text's background looks terrible.

Any help would be much appreciated. Thanks
Sorry, only registered users may post in this forum.

Click here to login