getcolor function returns the current drawing color.

Declaration : int getcolor();

e.g. a = getcolor(); // a is an integer variable
if current drawing color is WHITE then a will be 15.
See colors in c graphics.

[ad type=”banner”]

C programming code for getcolor

[pastacode lang=”c” manual=”%23include%3Cgraphics.h%3E%0A%23include%3Cconio.h%3E%0A%20%0Amain()%0A%7B%0A%20%20%20int%20gd%20%3D%20DETECT%2C%20gm%2C%20drawing_color%3B%0A%20%20%20char%20a%5B100%5D%3B%0A%20%0A%20%20%20initgraph(%26gd%2C%26gm%2C%22C%3A%5C%5CTC%5C%5CBGI%22)%3B%0A%20%0A%20%20%20drawing_color%20%3D%20getcolor()%3B%0A%20%0A%20%20%20sprintf(a%2C%22Current%20drawing%20color%20%3D%20%25d%22%2C%20drawing_color)%3B%0A%20%20%20outtextxy(%2010%2C%2010%2C%20a%20)%3B%0A%20%0A%20%20%20getch()%3B%0A%20%20%20closegraph()%3B%0A%20%20%20return%200%3B%0A%7D” message=”” highlight=”” provider=”manual”/] [ad type=”banner”]

Categorized in: