I 'm using DEV-C++ to write my c program. And also I want to change the text color in the program in windows console environment. From my knowledge, I know that we can change 15 colors by using
However I need more colors. I heard that curses can do it. But in DEV-C++, there are not <curses.h> header file. And I don't really understand how to use it or if it can help me to use with more colorful text color. Also, I tried to download ncurses 5.6 and curses 1.23. However, I don't know if they are useful or not. And I don't know how to use them.
So, please help me to answer the question.
And I need a example program which can be compiled in DEV-C++. Also, I'm using windows but not unix or linux. And my knowledge is very limited, please give me more details about it. Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Windows console only supports a 16 colour palette, using combinations 1 bit of R, G, and B values and an 'intensity' bit, as documented here: http://msdn.microsoft.com/en-us/library/ms682088(VS.85).aspx.
In the console properties dialog, you can redefine any of the 16 colours from a 24bit gamut, but I am not sure how you can do that programatically. But you can still have only 16 colours simultaneously.
pdcurses will not solve these system limitations.
If you want more colours you will need to use a graphical window rather than a text console. Normally this implies a GUI application, but if you want the simplicity of a console application but with graphical output (thus supporting more colours and fonts) you can use the Windows GDI directly. One simple way of doing that is to use WinBGIm, a clone of Borland's antique but easy to use BGI interface implemented using Windows GDI. Greater flexibility is afforded by using GDI directly, but it is rather cumbersome. WinBGIm is provided as source code, so you can use it to see how it is done, and even mix BGI and GDI calls. http://codecutter.org/tools/winbgim/
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you want to use a curses library,
you can get pdCurses from the sourceforge pdCurses site.
You can also use Dev-cpps devpak download manager to install it for you.
Unless you redefine the colour pair values you are only going to
be able to use a small range of colours though.
You do know that you can left click the console window and
change the outputted colours from there don't you,
or did you want to define your own colours?
If you don't know how to use curses check up on the manual.
It's easy peesy.
An example program for Dev-cpp to compile...
there everywhere,but...
I 'm using DEV-C++ to write my c program. And also I want to change the text color in the program in windows console environment. From my knowledge, I know that we can change 15 colors by using
CODESetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED);
However I need more colors. I heard that curses can do it. But in DEV-C++, there are not <curses.h> header file. And I don't really understand how to use it or if it can help me to use with more colorful text color. Also, I tried to download ncurses 5.6 and curses 1.23. However, I don't know if they are useful or not. And I don't know how to use them.
So, please help me to answer the question.
And I need a example program which can be compiled in DEV-C++. Also, I'm using windows but not unix or linux. And my knowledge is very limited, please give me more details about it. Thank you.
The Windows console only supports a 16 colour palette, using combinations 1 bit of R, G, and B values and an 'intensity' bit, as documented here: http://msdn.microsoft.com/en-us/library/ms682088(VS.85).aspx.
In the console properties dialog, you can redefine any of the 16 colours from a 24bit gamut, but I am not sure how you can do that programatically. But you can still have only 16 colours simultaneously.
pdcurses will not solve these system limitations.
If you want more colours you will need to use a graphical window rather than a text console. Normally this implies a GUI application, but if you want the simplicity of a console application but with graphical output (thus supporting more colours and fonts) you can use the Windows GDI directly. One simple way of doing that is to use WinBGIm, a clone of Borland's antique but easy to use BGI interface implemented using Windows GDI. Greater flexibility is afforded by using GDI directly, but it is rather cumbersome. WinBGIm is provided as source code, so you can use it to see how it is done, and even mix BGI and GDI calls. http://codecutter.org/tools/winbgim/
Clifford
If you want to use a curses library,
you can get pdCurses from the sourceforge pdCurses site.
You can also use Dev-cpps devpak download manager to install it for you.
Unless you redefine the colour pair values you are only going to
be able to use a small range of colours though.
You do know that you can left click the console window and
change the outputted colours from there don't you,
or did you want to define your own colours?
If you don't know how to use curses check up on the manual.
It's easy peesy.
An example program for Dev-cpp to compile...
there everywhere,but...
include <iostream>
int main()
{
std::cout << "g'day planet earth,\nI'm leaving today\n\n\n" ;
system( "pause" );
return 0;
}