Teen Programmers Unite  


Return to forum top

Colors in the Console using C

Posted by Mycroft [send private reply] at March 09, 2002, 08:00:11 PM

I'm working on a console program and want to use different colored text and backgrounds. I know how to make red, blu, green, orange, purple, black, and white with CHAR_INFO attributes but can I make other colors too? If so how?

Posted by AREM [send private reply] at March 10, 2002, 02:56:21 PM

You can make custon colors using RGB(). An easy way to remember is Red Green Blue (RGB) :). you enter a number for each color ex: RGB(255,0,0) = all red.

Posted by Mycroft [send private reply] at March 10, 2002, 05:02:19 PM

How do I use the RGB() function to change colors, do I put it in the CHAR_INFO attributes?

screenBuffer[counter].Attributes = RGB(255,0,0); <-WOULD THIS WORK

Posted by AREM [send private reply] at March 11, 2002, 09:31:14 PM

I've never used the CHAR_INFO attributes but you would put it where you would put the color.

Posted by CodeRed [send private reply] at March 13, 2002, 11:49:30 AM

I don't think that that is native C code, you must be using some kind of a graphics library, in which case Mycroft would have no idea what you are talking about.

You must be logged in to post messages and see which you have already read.

Log on
Save for later automatic logon

Register as a new user
Copyright TPU 2002. See the Credits and About TPU for more information.