back gound Colour

How to set a background colour.........
On Windows:
 
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), color );
where color is the same as the EGA/VGA text attribute value.

Low-nibble = foreground color
High-nibble = background color

bits
0 fg blue
1 fg green
2 fg red
3 fg intensity
4 bg blue
5 bg green
6 bg red
7 bg intensity

So, the value for, say, light cyan on blue is 0x1B.

If you are on Linux, ask for more. (I've got to go now.) Hope this helps.
How to set a back ground colour in 'c'
Is that a trick question?
Last edited on
i means if we want to change colour of background or chage the colour or our language print in printf or change the font style or font colour...is it possible in c lang...?????
...yes, that's exactly what the code does.

If you read that post AT ALL, then you'd understand how to use it. It's all there FOR you, just fill in where it says color with 0x(lower-nibble)(higher-nibble)
Topic archived. No new replies allowed.