You are here

Setbkcolor function in c

Declaration: void setbkcolor(int color);

setbkcolor function changes current background color e.g. setbkcolor(YELLLOW) changes the current background color to YELLOW.
Remember that default drawing color is WHITE and background color is BLACK.

C programming code for setbkcolor

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  8.    
  9.    outtext("Press any key to change the background color to GREEN.");
  10.    getch();
  11.    
  12.    setbkcolor(GREEN);
  13.    
  14.    getch();
  15.    closegraph();
  16.    return 0;
  17. }