home *** CD-ROM | disk | FTP | other *** search
- /* COLOR(fg, bg, bd) -- set foreground, background, and border colors
-
- Copyright (c) 1984, 1985 by JMI Software Consultants, Inc.
- */
- #include "bio.h"
-
- /* Color definitions
-
- foreground and border colors
- fg color display monochrome display
- 0 black black
- 1 blue white with underline
- 2 green white
- 3 cyan white
- 4 red white
- 5 magenta white
- 6 brown white
- 7 white white
- 8 gray black
- 9 light blue intense white with underline
- 10 light green intense white
- 11 light cyan intense white
- 12 light red intense white
- 13 light magenta intense white
- 14 yellow intense white
- 15 intense white intense white
-
- The foreground can be made to blink by adding 16 to the fg
- values above.
-
- background colors
- bg color display monochrome display
- 0 black black
- 1 blue black
- 2 green black
- 3 cyan black
- 4 red black
- 5 magenta black
- 6 brown black
- 7 white white
-
- With the monochrome display, fg values of 0, 8, 16, 24 only
- show up as black when used with bg values 0 or 7.
- Also, a bg value of 7 only shows up black when used with
- fg values of 0, 8, 16, or 24.
- All other combinations of fg and bg produce a normal
- white on black display.
-
- */
-
- LOCAL TEXT *clr[] =
- {
- "30", "34", "32", "36", /* 0 - 3 */
- "31", "35", "33", "37", /* 4 - 7 */
- };
-
-
- VOID COLOR(fg, bg, bd)
- INT fg, bg, bd;
- {
- INTERN TEXT s[25];
- COUNT i;
-
- i = 0;
- s[i++] = '\033';
- s[i++] = '[';
- s[i++] = '0';
- s[i++] = ';';
- if (fg >= 0)
- {
- if (fg > 15 && fg < 32)
- {
- fg = fg - 16;
- s[i++] = '5';
- s[i++] = ';';
- }
- if (fg > 7 && fg < 16)
- {
- fg = fg - 8;
- s[i++] = '1';
- s[i++] = ';';
- }
- s[i++] = clr[fg][0];
- s[i++] = clr[fg][1];
- }
- if (bg >= 0)
- {
- s[i++] = ';';
- bg &= 7;
- s[i++] = clr[bg][0] + 1;
- s[i++] = clr[bg][1];
- }
- s[i++] = 'm';
- s[i] = '$';
- bdos(9, s);
- if (bd != -1)
- {
- bd &= 0x1f;
- outp(0x3D9, bd);
- }
- }