How to Change your (dev/visual) console color

     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 idColorColor idColor
1Blue9Light Blue
2Green0Black
3AquaALight Green
4RedBLight Aqua
5PurpleCLight Red
6YellowDLight Purple
7WhiteELight Yellow
8GrayFBright 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

Popular posts from this blog

Loops and Functions Session 8

Python Installation

Variable & Data Types (Session 3)