Colours in graphics


Colors in C

C language supports several differnt colors that are used in graphics or in console too.

There are inbuilt color constants that represent different colors. These colors has their respective integer values too.

Following are the different colors that are present in C :

Constant        Value

BLACK 0

BLUE 1

GREEN 2

CYAN 3

RED 4

MAGENTA 5

BROWN 6

LIGHTGRAY 7

DARKGRAY 8

LIGHTBLUE 9

LIGHTGREEN 10

LIGHTCYAN 11

LIGHTRED 12

LIGHTMAGENTA 13

YELLOW 14

WHITE 15

_______________________

BLINK 128


These colors can be used either by :

  • Specifying the Constant name or
  • Specifying the Value

For Example--following both statement are true for the blue color :

setcolor(BLUE)----Constant name is specified.

setcolor(1)--------Value is specified.

0 comments:

Post a Comment