how can i change my font color in c++? can you give me a sample code in changing font color
font color in c++
Page 1 of 17 Replies - 70581 Views - Last Post: 26 August 2012 - 03:40 PM
Replies To: font color in c++
#2
Re: font color in c++
Posted 05 October 2009 - 09:15 AM
For a windows machine you can use
system("COLOR 1e") this example will give you a blue background with light yellow text.
system("COLOR 1e") this example will give you a blue background with light yellow text.
#4
Re: font color in c++
Posted 05 October 2009 - 09:28 AM
Here are the colors:
system("COLOR [background][text]");
O- black 9- light blue
1-blue a- light green
2-green b- light aqua
3-aqua c- light red
4-red d- light purple
5-purple e- light yellow
6-yellow f- bright white
7-white
8-gray
system("COLOR [background][text]");
O- black 9- light blue
1-blue a- light green
2-green b- light aqua
3-aqua c- light red
4-red d- light purple
5-purple e- light yellow
6-yellow f- bright white
7-white
8-gray
#5
Re: font color in c++
Posted 05 October 2009 - 11:15 AM
Why do people continue to use system to do these things?
Anyway, color in a C++ console application is pretty platform dependent. There are some cross platform libraries you can look into sucha as ncurses.
So, unless you look into one of those platform independent libraries, you will have to use the features of your target platform,
For example for windows you can see my Windows Console Output snippet which contains some basic functions for controlling the windows console.
There are also a number of other snippets for color in our snippets section.
(added to FAQ)
BTW: for any snippet developers out there... the Linux console colors is WAY under represented in our C/C++ snippets. I know we can get a few more out there... We have about a million windows ones and like what 1 Linux one? Where are the Linux programmer's at?
Anyway, color in a C++ console application is pretty platform dependent. There are some cross platform libraries you can look into sucha as ncurses.
So, unless you look into one of those platform independent libraries, you will have to use the features of your target platform,
For example for windows you can see my Windows Console Output snippet which contains some basic functions for controlling the windows console.
There are also a number of other snippets for color in our snippets section.
- Linux ColorClass in C++ by ZachR
- Easy cout color change in C++ by Over (windows)
- Set Text Color in C++ by nirvanarupali
- Esc key characters in DOS in C++ by no2pencil
- Color Console C++ in C++ by okyup
- Screen Class in C++ by dance_monkey()
- Windows Console Get/Set Colors in C by NickDMax
- Windows Console Output snippet in C by NickDMax
- PrintfExt - (printf Extension) in C by Hyper
- Display color in C by nirvanarupali
(added to FAQ)
BTW: for any snippet developers out there... the Linux console colors is WAY under represented in our C/C++ snippets. I know we can get a few more out there... We have about a million windows ones and like what 1 Linux one? Where are the Linux programmer's at?
#6
Re: font color in c++
Posted 24 August 2012 - 07:04 AM
NickDMax, on 05 October 2009 - 02:15 PM, said:
BTW: for any snippet developers out there... the Linux console colors is WAY under represented in our C/C++ snippets. I know we can get a few more out there... We have about a million windows ones and like what 1 Linux one? Where are the Linux programmer's at?
My Rock Paper & Scissors tutorial uses Linux console color changing text through a custom function & defines. Just adding this to your list (3 years later).
#7
Re: font color in c++
Posted 25 August 2012 - 02:22 AM
I did not expect that you would necro a 3 year old topic....
#8
Re: font color in c++
Posted 26 August 2012 - 03:40 PM
It's listed under the C/C++ faq, feel free to post helpful comments.
Page 1 of 1

New Topic/Question
Reply



MultiQuote




|