PRODUCT : Borland C++ NUMBER : 1302 VERSION : 3.x OS : DOS DATE : October 25, 1993 PAGE : 1/2 TITLE : How to display black text using BGI graphics. QUESTION: How do I display black text in bgi graphics? Attempts to display text after a call to setcolor(BLACK) fail after a previous call to setbkcolor(). ANSWER: The zeroth entry in the palette is the background color. When setbkcolor() was called the index to BLACK was lost. To fix this replace one of the palette entries with BLACK and use that index for BLACK. EXAMPLE: #include #include #include #include #define NEWCOLOR 5 //we will take over color number 5 in palette int main(void) { char msg[80]= "this is a test"; int bkcol, maxcolor, x, y; int gdriver = DETECT, gmode, errorcode; /* initialize graphics mode */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* return with error code */ } /* for centering text messages */ settextjustify(CENTER_TEXT, CENTER_TEXT); x = getmaxx() / 2; y = getmaxy() / 2; setpalette(NEWCOLOR, BLACK); //set one color number to BLACK PRODUCT : Borland C++ NUMBER : 1302 VERSION : 3.x OS : DOS DATE : October 25, 1993 PAGE : 2/2 TITLE : How to display black text using BGI graphics. /* select a new background color */ setbkcolor(RED); /* select a new color */ setcolor(NEWCOLOR); /* output a messsage */ outtextxy(x, y, msg); getch(); /* clean up */ closegraph(); return 0; } DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.