Here I'm Sharing how can you change your console color Also How to print Colored text in C++
As you know, In C++ Programming the output screen color is black and the text is in white color but we can change it using these steps:
Step 1:
Add these Header Files
#include <windows.h>
or
#include <stdlib.h>
Step 2:
Use this syntax
system("Color XY")
Here the value X is use to change Background color
and and the value Y is used to change the text color.
Use these color id's in XY value:
|
| Color id | Color | Color id | Color |
---|
1 | Blue | 9 | Light Blue | 2 | Green | 0 | Black | 3 | Aqua | A | Light Green | 4 | Red | B | Light Aqua | 5 | Purple | C | Light Red | 6 | Yellow | D | Light Purple | 7 | White | E | Light Yellow | 8 | Gray | F | Bright White |
Example for Color Text: #include <iostream> #include <windows.h> using namespace std;
// Driver Code int main() { // 0 for background Color // A for text color system("Color 0A"); // Print any message cout << "TECHNOCODES"; return 0; } Example for Color Background:
#include <iostream> #include <stdlib.h> using namespace std;
// Driver Code int main() { // Print any message cout << "TECHNOCODES";
// E for background Color // 4 for text color system("Color E4");
return 0; }
| |
---|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| |
---|
| | |
|
Comments
Post a Comment