The master and develop branches track hengband.
OS X development happens on the macos-1-6-2, macos-2-2-1, and macos-develop branches.
Revisão | 46c3450c794ae3d178d4c1ee8ad1af9274edb03d (tree) |
---|---|
Hora | 2022-06-22 03:11:52 |
Autor | Eric Branlund <ebranlund@fast...> |
Commiter | Eric Branlund |
Linux/Unix: adapt color handling from Angband 4.2.4 for gcu frontend; with the default colors and terminals with an extended color range, avoids white backgrounds in lit areas and parts of the stats panel and character screen
@@ -13,147 +13,6 @@ | ||
13 | 13 | /* |
14 | 14 | * This file has been modified to use multiple text windows if your screen |
15 | 15 | * is larger than 80x25. By Keldon Jones (keldon@umr.edu). |
16 | - * | |
17 | - * Also included is Keldon Jones patch to get better colors. To switch to | |
18 | - * a term that supports this, see this posting: | |
19 | - * | |
20 | - * From keldon@umr.edu Thu Apr 01 05:40:14 1999 | |
21 | - * Sender: KELDON JONES <keldon@saucer.cc.umr.edu> | |
22 | - * From: Keldon Jones <keldon@umr.edu> | |
23 | - * Subject: Re: Linux colour prob (Or: question for Greg) | |
24 | - * Newsgroups: rec.games.roguelike.angband | |
25 | - * References: <slrn7g1jlp.gj9.scarblac-spamtrap@flits104-37.flits.rug.nl> <3700f96b.1593384@news.polsl.gliwice.pl> <slrn7g36er.fm4.wooledge@jekyll.local> | |
26 | - * X-Newsreader: TIN [UNIX 1.3 unoff BETA 970625; 9000/780 HP-UX B.10.20] | |
27 | - * NNTP-Posting-Host: saucer.cc.umr.edu | |
28 | - * X-NNTP-Posting-Host: saucer.cc.umr.edu | |
29 | - * Message-ID: <370306be.0@news.cc.umr.edu> | |
30 | - * Date: 1 Apr 99 05:40:14 GMT | |
31 | - * Organization: University of Missouri - Rolla | |
32 | - * Lines: 199 | |
33 | - * Path: xs4all!xs4all!newsfeed.wirehub.nl!news-peer.gip.net!news.gsl.net!gip.net!news.he.net!mercury.cts.com!alpha.sky.net!news.missouri.edu!news.cc.umr.edu!not-for-mail | |
34 | - * Xref: xs4all rec.games.roguelike.angband:86332 | |
35 | - * | |
36 | - * Greg Wooledge <wooledge@kellnet.com> wrote: | |
37 | - * > Gwidon S. Naskrent (naskrent@artemida.amu.edu.pl) wrote: | |
38 | - * | |
39 | - * > >On 30 Mar 1999 13:17:18 GMT, scarblac-spamtrap@pino.selwerd.cx (Remco | |
40 | - * > >Gerlich) wrote: | |
41 | - * | |
42 | - * > >>I recently switched to Linux, and *bands work fine. I like | |
43 | - * > >>to play them in consoles, not in X. However, colour is wrong. | |
44 | - * > >>"Slate" and "light slate" are always light blue, instead | |
45 | - * > >>of some shade of grey. Colours are fine in X. | |
46 | - * | |
47 | - * > I actually noticed the Linux console color issue a very long time ago, | |
48 | - * > but since I always play under X, I never really investigated it. | |
49 | - * | |
50 | - * > You're absolutely right, though -- the Linux console colors are not | |
51 | - * > "right" for Angband. | |
52 | - * | |
53 | - * I've noticed this myself, so I spent the evening fixing it. | |
54 | - * Well, sorta fixing it. It's not perfect yet, and it may not be | |
55 | - * possible to get it perfect with VGA hardware and/or the current | |
56 | - * Linux kernel. | |
57 | - * | |
58 | - * > OK, reading on in terminfo(5): | |
59 | - * | |
60 | - * > Color Handling | |
61 | - * > Most color terminals are either `Tektronix-like' or `HP- | |
62 | - * > like'. Tektronix-like terminals have a predefined set of | |
63 | - * > N colors (where N usually 8), and can set character-cell | |
64 | - * > foreground and background characters independently, mixing | |
65 | - * > them into N * N color-pairs. On HP-like terminals, the | |
66 | - * > use must set each color pair up separately (foreground and | |
67 | - * > background are not independently settable). Up to M | |
68 | - * > color-pairs may be set up from 2*M different colors. | |
69 | - * > ANSI-compatible terminals are Tektronix-like. | |
70 | - * | |
71 | - * > The "linux" terminfo entry is definitely in the "Tektronix-like" family. | |
72 | - * > It has the "setaf" and "setab" capabilities for setting the foreground | |
73 | - * > and background colors to one of 8 basically hard-coded values: | |
74 | - * | |
75 | - * > Color #define Value RGB | |
76 | - * > black COLOR_BLACK 0 0, 0, 0 | |
77 | - * > red COLOR_RED 1 max,0,0 | |
78 | - * > green COLOR_GREEN 2 0,max,0 | |
79 | - * > yellow COLOR_YELLOW 3 max,max,0 | |
80 | - * > blue COLOR_BLUE 4 0,0,max | |
81 | - * > magenta COLOR_MAGENTA 5 max,0,max | |
82 | - * > cyan COLOR_CYAN 6 0,max,max | |
83 | - * > white COLOR_WHITE 7 max,max,max | |
84 | - * | |
85 | - * Well, not quite. Using certain escape sequences, an | |
86 | - * application (or better yet, curses) can redefine the colors (at | |
87 | - * least some of them) and then those are used. Read the | |
88 | - * curs_color manpage, and the part about "ccc" and "initc" in the | |
89 | - * terminfo manpage. This is what the part of main-gcu inside the | |
90 | - * "if (can_fix_color)" code does. | |
91 | - * | |
92 | - * > So, what does this mean to the Angband player? Well, it means that | |
93 | - * > either there's nothing you can do about the console colors as long as | |
94 | - * > straight curses/ncurses is used, or if there is something to be done, | |
95 | - * > I'm not clever enough to figure out how to do it. | |
96 | - * | |
97 | - * Well, it is possible, though you have to patch main-gcu | |
98 | - * and edit a terminfo entry. Apparently the relevant code in | |
99 | - * main-gcu was never tested (it's broken in at least one major | |
100 | - * way). Apply the patch at the end of this message (notice that | |
101 | - * we need to define REDEFINE_COLORS at some point near the | |
102 | - * beginning of the file). | |
103 | - * Next, write this termcap entry to a file: | |
104 | - * | |
105 | - * linux-c|linux console 1.3.6+ with private palette for each virtual console, | |
106 | - * ccc, | |
107 | - * colors#16, pairs#64, | |
108 | - * initc=\E]P%x%p1%{16}%/%02x%p1%{16}%/%02x%p1%{16}%/%02x, | |
109 | - * oc=\E]R, | |
110 | - * use=linux, | |
111 | - * | |
112 | - * and run "tic" on it to produce a new terminfo entry called | |
113 | - * "linux-c". Especially note the "ccc" flag which says that we | |
114 | - * can redefine colors. The ugly "initc" string is what tells | |
115 | - * the console how to redefine a color. Now, just set your TERM | |
116 | - * variable to "linux-c" and try Angband again. If I've | |
117 | - * remembered to tell you everything that I've done, you should | |
118 | - * get the weird light-blue slate changed to a gray. | |
119 | - * Now, there are still lots of problems with this. | |
120 | - * Something (I don't think it's curses, either the kernel or | |
121 | - * the hardware itself) seems to be ignoring my color changes to | |
122 | - * colors 6 and 7, which is annoying. Also, the normal "white" | |
123 | - * color is now way too bright, but it's now necessary to | |
124 | - * distinguish it from the other grays. | |
125 | - * The kernel seems to support 16 colors, but you can | |
126 | - * only switch to 8 of those, due to VT102 compatibility, it | |
127 | - * seems. I think it would be possible to patch the kernel and | |
128 | - * allow all 16 colors to be used, but I haven't built up the | |
129 | - * nerve to try that yet. | |
130 | - * Let me know if you can improve on this any. Some of | |
131 | - * this may actually work differently on other hardware (ugh). | |
132 | - * | |
133 | - * Keldon | |
134 | - * | |
135 | - */ | |
136 | - | |
137 | -/* | |
138 | - * To use this file, you must define "USE_GCU" in the Makefile. | |
139 | - * | |
140 | - * Hack -- note that "angband.h" is included AFTER the #ifdef test. | |
141 | - * This was necessary because of annoying "curses.h" silliness. | |
142 | - * | |
143 | - * Note that this file is not "intended" to support non-Unix machines, | |
144 | - * nor is it intended to support VMS or other bizarre setups. | |
145 | - * | |
146 | - * Also, this package assumes that the underlying "curses" handles both | |
147 | - * the "nonl()" and "cbreak()" commands correctly, see the "OPTION" below. | |
148 | - * | |
149 | - * This code should work with most versions of "curses" or "ncurses", | |
150 | - * and the "main-ncu.c" file (and USE_NCU define) are no longer used. | |
151 | - * | |
152 | - * See also "USE_CAP" and "main-cap.c" for code that bypasses "curses" | |
153 | - * and uses the "termcap" information directly, or even bypasses the | |
154 | - * "termcap" information and sends direct vt100 escape sequences. | |
155 | - * | |
156 | - * XXX XXX XXX Consider the use of "savetty()" and "resetty()". | |
157 | 16 | */ |
158 | 17 | |
159 | 18 | #include "angband.h" |
@@ -220,13 +79,6 @@ static term_data data[MAX_TERM_DATA]; | ||
220 | 79 | #endif |
221 | 80 | |
222 | 81 | /* |
223 | - * Try redefining the colors at startup. | |
224 | - */ | |
225 | -#define REDEFINE_COLORS | |
226 | - | |
227 | - | |
228 | - | |
229 | -/* | |
230 | 82 | * POSIX stuff |
231 | 83 | */ |
232 | 84 | #ifdef USE_TPOSIX |
@@ -354,14 +206,34 @@ static int active = 0; | ||
354 | 206 | static int can_use_color = FALSE; |
355 | 207 | |
356 | 208 | /* |
357 | - * Software flag -- we are allowed to change the colors | |
209 | + * Simple Angband to Curses color conversion table | |
358 | 210 | */ |
359 | -static int can_fix_color = FALSE; | |
211 | +static int colortable[16]; | |
360 | 212 | |
361 | 213 | /* |
362 | - * Simple Angband to Curses color conversion table | |
214 | + * If TRUE, use A_BRIGHT with colors on 88 and 256 color terminals. | |
363 | 215 | */ |
364 | -static int colortable[16]; | |
216 | +static int bold_extended = FALSE; | |
217 | + | |
218 | +/* | |
219 | + * If TRUE, don't change the terminal's color table, even if otherwise | |
220 | + * allowed. | |
221 | + */ | |
222 | +static int keep_terminal_colors = FALSE; | |
223 | + | |
224 | +/* | |
225 | + * The background color we should draw with. | |
226 | + */ | |
227 | +static int bg_color = COLOR_BLACK; | |
228 | + | |
229 | +#define PAIR_WHITE 0 | |
230 | +#define PAIR_RED 1 | |
231 | +#define PAIR_GREEN 2 | |
232 | +#define PAIR_YELLOW 3 | |
233 | +#define PAIR_BLUE 4 | |
234 | +#define PAIR_MAGENTA 5 | |
235 | +#define PAIR_CYAN 6 | |
236 | +#define PAIR_BLACK 7 | |
365 | 237 | |
366 | 238 | #endif |
367 | 239 |
@@ -854,6 +726,104 @@ static errr Term_xtra_gcu_event(int v) | ||
854 | 726 | |
855 | 727 | #endif /* USE_GETCH */ |
856 | 728 | |
729 | +static int scale_color(int i, int j, int scale) | |
730 | +{ | |
731 | + return (angband_color_table[i][j] * (scale - 1) + 127) / 255; | |
732 | +} | |
733 | + | |
734 | +static int create_color(int i, int scale) | |
735 | +{ | |
736 | + int r = scale_color(i, 1, scale); | |
737 | + int g = scale_color(i, 2, scale); | |
738 | + int b = scale_color(i, 3, scale); | |
739 | + int rgb = 16 + scale * scale * r + scale * g + b; | |
740 | + | |
741 | + /* In the case of white and black we need to use the ANSI colors */ | |
742 | + if (r == g && g == b) { | |
743 | + if (b == 0) rgb = 0; | |
744 | + if (b == scale) rgb = 15; | |
745 | + } | |
746 | + | |
747 | + return rgb; | |
748 | +} | |
749 | + | |
750 | + | |
751 | +/* | |
752 | + * Adjust the color tables if there's more than 16 available. | |
753 | + */ | |
754 | +static void handle_extended_color_tables(void) | |
755 | +{ | |
756 | +#ifdef A_COLOR | |
757 | + if (COLORS == 256 || COLORS == 88) | |
758 | + { | |
759 | + int isbold = bold_extended ? A_BRIGHT : A_NORMAL; | |
760 | + int i; | |
761 | + | |
762 | + if (keep_terminal_colors) { | |
763 | + /* | |
764 | + * If we have more than 16 colors, find the best | |
765 | + * matches in the terminal's default color table. | |
766 | + * These numbers correspond to xterm/rxvt's builtin | |
767 | + * color numbers--they do not correspond to curses' | |
768 | + * constants OR with curses' color pairs. | |
769 | + * | |
770 | + * XTerm has 216 (6*6*6) RGB colors, with each RGB | |
771 | + * setting 0-5. | |
772 | + * RXVT has 64 (4*4*4) RGB colors, with each RGB | |
773 | + * setting 0-3. | |
774 | + * | |
775 | + * Both also have the basic 16 ANSI colors, plus some | |
776 | + * extra grayscale colors which we do not use. | |
777 | + */ | |
778 | + int scale = COLORS == 256 ? 6 : 4; | |
779 | + | |
780 | + bg_color = create_color(TERM_DARK, scale); | |
781 | + for (i = 0; i < 16; i++) | |
782 | + { | |
783 | + int fg = create_color(i, scale); | |
784 | + init_pair(i + 1, fg, bg_color); | |
785 | + colortable[i] = COLOR_PAIR(i + 1) | isbold; | |
786 | + } | |
787 | + } else { | |
788 | + bg_color = 0; | |
789 | + for (i = 0; i < 16; i++) | |
790 | + { | |
791 | + /* | |
792 | + * Scale components to a range of 0 - 1000 per | |
793 | + * init_color()'s documentation. | |
794 | + */ | |
795 | + init_color(i, | |
796 | + (angband_color_table[i][1] * 1001) / 256, | |
797 | + (angband_color_table[i][2] * 1001) / 256, | |
798 | + (angband_color_table[i][3] * 1001) / 256); | |
799 | + init_pair(i + 1, i, bg_color); | |
800 | + colortable[i] = COLOR_PAIR(i + 1) | isbold; | |
801 | + } | |
802 | + } | |
803 | + | |
804 | + for (i = 0; i < MAX_TERM_DATA; ++i) { | |
805 | + if (data[i].win) { | |
806 | + wbkgdset(data[i].win, ' ' | colortable[TERM_DARK]); | |
807 | + } | |
808 | + } | |
809 | + if (data[0].win) { | |
810 | + /* | |
811 | + * Adjust the background color on the standard screen | |
812 | + * as well so separators between the terminals have | |
813 | + * the same background as the rest. | |
814 | + */ | |
815 | + chtype term0_bkg = getbkgd(data[0].win); | |
816 | + | |
817 | + if (getbkgd(stdscr) != term0_bkg) { | |
818 | + wbkgd(stdscr, term0_bkg); | |
819 | + wrefresh(stdscr); | |
820 | + } | |
821 | + } | |
822 | + } | |
823 | +#endif | |
824 | +} | |
825 | + | |
826 | + | |
857 | 827 | #ifdef USE_SOUND |
858 | 828 | |
859 | 829 | /* |
@@ -911,34 +881,6 @@ static errr Term_xtra_gcu_sound(int v) | ||
911 | 881 | } |
912 | 882 | #endif |
913 | 883 | |
914 | -/* | |
915 | - * React to changes | |
916 | - */ | |
917 | -static errr Term_xtra_gcu_react(void) | |
918 | -{ | |
919 | - | |
920 | -#ifdef A_COLOR | |
921 | - | |
922 | - int i; | |
923 | - | |
924 | - /* Cannot handle color redefinition */ | |
925 | - if (!can_fix_color) return (0); | |
926 | - | |
927 | - /* Set the colors */ | |
928 | - for (i = 0; i < 16; i++) | |
929 | - { | |
930 | - /* Set one color (note scaling) */ | |
931 | - init_color(i, angband_color_table[i][1] * 1000 / 255, | |
932 | - angband_color_table[i][2] * 1000 / 255, | |
933 | - angband_color_table[i][3] * 1000 / 255); | |
934 | - } | |
935 | - | |
936 | -#endif | |
937 | - | |
938 | - /* Success */ | |
939 | - return (0); | |
940 | -} | |
941 | - | |
942 | 884 | |
943 | 885 | /* |
944 | 886 | * Handle a "special request" |
@@ -1001,7 +943,7 @@ static errr Term_xtra_gcu(int n, int v) | ||
1001 | 943 | |
1002 | 944 | /* React to events */ |
1003 | 945 | case TERM_XTRA_REACT: |
1004 | - Term_xtra_gcu_react(); | |
946 | + handle_extended_color_tables(); | |
1005 | 947 | return (0); |
1006 | 948 | |
1007 | 949 | } |
@@ -1047,7 +989,13 @@ static errr Term_wipe_gcu(int x, int y, int n) | ||
1047 | 989 | /* Clear some characters */ |
1048 | 990 | else |
1049 | 991 | { |
1050 | - while (n-- > 0) waddch(td->win, ' '); | |
992 | +#ifdef A_COLOR | |
993 | + if (can_use_color) wattrset(td->win, colortable[TERM_DARK]); | |
994 | +#endif | |
995 | + whline(td->win, ' ', n); | |
996 | +#ifdef A_COLOR | |
997 | + if (can_use_color) wattrset(td->win, WA_NORMAL); | |
998 | +#endif | |
1051 | 999 | } |
1052 | 1000 | |
1053 | 1001 | /* Success */ |
@@ -1073,7 +1021,7 @@ static void Term_acs_text_gcu(int x, int y, int n, byte a, cptr s) | ||
1073 | 1021 | |
1074 | 1022 | #ifdef A_COLOR |
1075 | 1023 | /* Set the color */ |
1076 | - wattrset(td->win, colortable[a & 0x0F]); | |
1024 | + if (can_use_color) wattrset(td->win, colortable[a & 0x0F]); | |
1077 | 1025 | #endif |
1078 | 1026 | |
1079 | 1027 | for (i=0; i < n; i++) |
@@ -1081,7 +1029,9 @@ static void Term_acs_text_gcu(int x, int y, int n, byte a, cptr s) | ||
1081 | 1029 | /* add acs_map of a */ |
1082 | 1030 | waddch(td->win, acs_map[(int)s[i]]); |
1083 | 1031 | } |
1084 | - wattrset(td->win, WA_NORMAL); | |
1032 | +#ifdef A_COLOR | |
1033 | + if (can_use_color) wattrset(td->win, WA_NORMAL); | |
1034 | +#endif | |
1085 | 1035 | } |
1086 | 1036 | #endif |
1087 | 1037 |
@@ -1113,6 +1063,10 @@ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) | ||
1113 | 1063 | /* Add the text */ |
1114 | 1064 | waddnstr(td->win, s, n); |
1115 | 1065 | |
1066 | +#ifdef A_COLOR | |
1067 | + if (can_use_color) wattrset(td->win, WA_NORMAL); | |
1068 | +#endif | |
1069 | + | |
1116 | 1070 | /* Success */ |
1117 | 1071 | return (0); |
1118 | 1072 | } |
@@ -1193,10 +1147,15 @@ errr init_gcu(int argc, char *argv[]) | ||
1193 | 1147 | int num_term = 4, next_win = 0; |
1194 | 1148 | char path[1024]; |
1195 | 1149 | |
1196 | - /* Unused */ | |
1197 | - (void)argc; | |
1198 | - (void)argv; | |
1199 | - | |
1150 | + /* Parse args */ | |
1151 | + for (i = 1; i < argc; i++) | |
1152 | + { | |
1153 | + if (prefix(argv[i], "-B")) { | |
1154 | + bold_extended = TRUE; | |
1155 | + } else if (prefix(argv[i], "-K")) { | |
1156 | + keep_terminal_colors = TRUE; | |
1157 | + } | |
1158 | + } | |
1200 | 1159 | |
1201 | 1160 | #ifdef USE_SOUND |
1202 | 1161 |
@@ -1236,69 +1195,39 @@ errr init_gcu(int argc, char *argv[]) | ||
1236 | 1195 | can_use_color = ((start_color() != ERR) && has_colors() && |
1237 | 1196 | (COLORS >= 8) && (COLOR_PAIRS >= 8)); |
1238 | 1197 | |
1239 | -#ifdef REDEFINE_COLORS | |
1240 | - /* Can we change colors? */ | |
1241 | - can_fix_color = (can_use_color && can_change_color() && | |
1242 | - (COLORS >= 16) && (COLOR_PAIRS > 8)); | |
1243 | -#endif | |
1198 | + if (!can_change_color()) keep_terminal_colors = TRUE; | |
1244 | 1199 | |
1245 | - /* Attempt to use customized colors */ | |
1246 | - if (can_fix_color) | |
1200 | + if (can_use_color) | |
1247 | 1201 | { |
1248 | 1202 | /* Prepare the color pairs */ |
1249 | - for (i = 1; i <= 63; i++) | |
1250 | - { | |
1251 | - /* Reset the color */ | |
1252 | - if (init_pair(i, (i - 1) % 8, (i - 1) / 8) == ERR) | |
1253 | - { | |
1254 | - quit("Color pair init failed"); | |
1255 | - } | |
1256 | - | |
1257 | - /* Set up the colormap */ | |
1258 | - colortable[i - 1] = (COLOR_PAIR(i) | A_NORMAL); | |
1259 | - colortable[i + 7] = (COLOR_PAIR(i) | A_BRIGHT); | |
1260 | - | |
1261 | - /* XXX XXX XXX Take account of "gamma correction" */ | |
1262 | - | |
1263 | - /* Prepare the "Angband Colors" */ | |
1264 | - Term_xtra_gcu_react(); | |
1265 | - } | |
1266 | - } | |
1267 | - /* Attempt to use colors */ | |
1268 | - else if (can_use_color) | |
1269 | - { | |
1270 | - /* Color-pair 0 is *always* WHITE on BLACK */ | |
1271 | - | |
1272 | - /* Prepare the color pairs */ | |
1273 | - init_pair(1, COLOR_RED, COLOR_BLACK); | |
1274 | - init_pair(2, COLOR_GREEN, COLOR_BLACK); | |
1275 | - init_pair(3, COLOR_YELLOW, COLOR_BLACK); | |
1276 | - init_pair(4, COLOR_BLUE, COLOR_BLACK); | |
1277 | - init_pair(5, COLOR_MAGENTA, COLOR_BLACK); | |
1278 | - init_pair(6, COLOR_CYAN, COLOR_BLACK); | |
1279 | - init_pair(7, COLOR_BLACK, COLOR_BLACK); | |
1280 | - | |
1281 | - /* Prepare the "Angband Colors" -- Bright white is too bright */ | |
1282 | - /* Changed in Drangband. Cyan as grey sucks -- -TM- */ | |
1283 | - colortable[0] = (COLOR_PAIR(7) | A_NORMAL); /* Black */ | |
1284 | - colortable[1] = (COLOR_PAIR(0) | A_BRIGHT); /* White */ | |
1285 | - colortable[2] = (COLOR_PAIR(0) | A_NORMAL); /* Grey XXX */ | |
1286 | - colortable[3] = (COLOR_PAIR(1) | A_BRIGHT); /* Orange XXX */ | |
1287 | - colortable[4] = (COLOR_PAIR(1) | A_NORMAL); /* Red */ | |
1288 | - colortable[5] = (COLOR_PAIR(2) | A_NORMAL); /* Green */ | |
1289 | - colortable[6] = (COLOR_PAIR(4) | A_NORMAL); /* Blue */ | |
1290 | - colortable[7] = (COLOR_PAIR(3) | A_NORMAL); /* Umber */ | |
1291 | - colortable[8] = (COLOR_PAIR(7) | A_BRIGHT); /* Dark-grey XXX */ | |
1292 | - colortable[9] = (COLOR_PAIR(0) | A_NORMAL); /* Light-grey XXX */ | |
1293 | - colortable[10] = (COLOR_PAIR(5) | A_NORMAL); /* Purple */ | |
1294 | - colortable[11] = (COLOR_PAIR(3) | A_BRIGHT); /* Yellow */ | |
1295 | - colortable[12] = (COLOR_PAIR(5) | A_BRIGHT); /* Light Red XXX */ | |
1296 | - colortable[13] = (COLOR_PAIR(2) | A_BRIGHT); /* Light Green */ | |
1297 | - colortable[14] = (COLOR_PAIR(4) | A_BRIGHT); /* Light Blue */ | |
1298 | - colortable[15] = (COLOR_PAIR(3) | A_NORMAL); /* Light Umber XXX */ | |
1299 | - | |
1203 | + /* PAIR_WHITE (pair 0) is *always* WHITE on BLACK */ | |
1204 | + init_pair(PAIR_RED, COLOR_RED, bg_color); | |
1205 | + init_pair(PAIR_GREEN, COLOR_GREEN, bg_color); | |
1206 | + init_pair(PAIR_YELLOW, COLOR_YELLOW, bg_color); | |
1207 | + init_pair(PAIR_BLUE, COLOR_BLUE, bg_color); | |
1208 | + init_pair(PAIR_MAGENTA, COLOR_MAGENTA, bg_color); | |
1209 | + init_pair(PAIR_CYAN, COLOR_CYAN, bg_color); | |
1210 | + init_pair(PAIR_BLACK, COLOR_BLACK, bg_color); | |
1211 | + | |
1212 | + /* Prepare the colors */ | |
1213 | + colortable[TERM_DARK] = (COLOR_PAIR(PAIR_BLACK)); | |
1214 | + colortable[TERM_WHITE] = (COLOR_PAIR(PAIR_WHITE) | A_BRIGHT); | |
1215 | + colortable[TERM_SLATE] = (COLOR_PAIR(PAIR_WHITE)); | |
1216 | + colortable[TERM_ORANGE] = (COLOR_PAIR(PAIR_YELLOW) | A_BRIGHT); | |
1217 | + colortable[TERM_RED] = (COLOR_PAIR(PAIR_RED)); | |
1218 | + colortable[TERM_GREEN] = (COLOR_PAIR(PAIR_GREEN)); | |
1219 | + colortable[TERM_BLUE] = (COLOR_PAIR(PAIR_BLUE)); | |
1220 | + colortable[TERM_UMBER] = (COLOR_PAIR(PAIR_YELLOW)); | |
1221 | + colortable[TERM_L_DARK] = (COLOR_PAIR(PAIR_BLACK) | A_BRIGHT); | |
1222 | + colortable[TERM_L_WHITE] = (COLOR_PAIR(PAIR_WHITE)); | |
1223 | + colortable[TERM_VIOLET] = (COLOR_PAIR(PAIR_MAGENTA)); | |
1224 | + colortable[TERM_YELLOW] = (COLOR_PAIR(PAIR_YELLOW) | A_BRIGHT); | |
1225 | + colortable[TERM_L_RED] = (COLOR_PAIR(PAIR_MAGENTA) | A_BRIGHT); | |
1226 | + colortable[TERM_L_GREEN] = (COLOR_PAIR(PAIR_GREEN) | A_BRIGHT); | |
1227 | + colortable[TERM_L_BLUE] = (COLOR_PAIR(PAIR_BLUE) | A_BRIGHT); | |
1228 | + colortable[TERM_L_UMBER] = (COLOR_PAIR(PAIR_YELLOW)); | |
1229 | + handle_extended_color_tables(); | |
1300 | 1230 | } |
1301 | - | |
1302 | 1231 | #endif |
1303 | 1232 | |
1304 | 1233 | #ifdef USE_SOUND |
@@ -539,6 +539,10 @@ int main(int argc, char *argv[]) | ||
539 | 539 | |
540 | 540 | #ifdef USE_GCU |
541 | 541 | puts(" -mgcu To use GCU (GNU Curses)"); |
542 | + puts(" -- Sub options"); | |
543 | + puts(" -- -B Use brighter bold characters"); | |
544 | + puts(" -- -K Keep the terminal's color table when changing colors"); | |
545 | + puts(""); | |
542 | 546 | #endif /* USE_GCU */ |
543 | 547 | |
544 | 548 | #ifdef USE_CAP |