Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create program to Change the Text Background Color.c #403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions C/program to Change the Text Background Color.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include<windows.h>
#include<stdio.h>

int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");

//BACKGROUND_RED| BACKGROUND_GREEN| BACKGROUND_BLUE| BACKGROUND_INTENSITY
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_RED|BACKGROUND_INTENSITY);
printf("\n\nStudytonight just showed you how to put colors to your code!!");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN);
printf("\n\nIsn't this Awesome?");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED);
printf("\n\nYou just did something that only 1 out of 10 coders are familiar of :)\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
printf("\n\nYou are doing great!!");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_BLUE|BACKGROUND_INTENSITY);
printf("\n\nThe best is yet to come!");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_INTENSITY);
printf("\n\nWhat are you waiting for?? Just play with it!!");

printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}