Eran
Eran

Reputation: 81

How can i color my text in orange color?

I'm trying to find how to color my text in orange.

I tried this:

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | BACKGROUND_GREEN);

But it will give me a red on green text.

Is it even possible to get the color orange? i tried different codes i found in the internet, but none of them gave me orange.

thanks for the help.

Upvotes: 1

Views: 4342

Answers (2)

ibadia
ibadia

Reputation: 919

` there is another way to change the color of text,,,, infact you can also change the color of console.

use system("color xy") where x is the background color and y is the text color and dont forget to include dos and windows header file here is the color table

FOR EXample

 #include <windows.h> /* code table   0 = Black       8 = Gray
 1 = Blue        9 = Light Blue
 2 = Green       A = Light Green
 3 = Aqua        B = Light Aqua
 4 = Red         C = Light Red
 5 = Purple      D = Light Purple
 6 = Yellow      E = Light Yellow
 7 = White       F = Bright White */
 #include<dos.h>
 system("color 12");`

Upvotes: 0

syntagma
syntagma

Reputation: 24344

You can try the following bit mask: FOREGROUND_RED | FOREGROUND_GREEN.

It will change the color of the text to orange. You may still want to experiment with BACKGROUND_* to adjust the background color to your needs.

Upvotes: 8

Related Questions