menu color timeout_msg 37;40 #80ffffff #00000000 std
menu color timeout 1;37;40 #c0ffffff #00000000 std
menu color help 37;40 #c0ffffff #00000000 std
- menu color msg07 37;40 #c0ffffff #40000000 std
+ menu color msg07 37;40 #90ffffff #00000000 std
+
+
+MENU MSGCOLOR fg_filter bg_filter shadow
+
+ Sets *all* the msgXX colors to a color scheme derived from the
+ fg_filter and bg_filter values. Background color zero is
+ always treated as transparent. The default corresponds to:
+
+ menu msgcolor #90ffffff #80ffffff std
+
+ This directive should come before any directive that
+ customizes individual msgXX colors.
MENU WIDTH 80
void console_prepare(void);
void console_cleanup(void);
-void set_msg_colors_global(unsigned int fg, unsigned int bg,
- enum color_table_shadow shadow);
-
extern const int message_base_color;
int mygetkey(clock_t timeout);
int show_message_file(const char *filename, const char *background);
+#define MSG_COLORS_DEF_FG 0x90ffffff
+#define MSG_COLORS_DEF_BG 0x80ffffff
+#define MSG_COLORS_DEF_SHADOW SHADOW_NORMAL
+void set_msg_colors_global(unsigned int fg, unsigned int bg,
+ enum color_table_shadow shadow);
+
#endif /* MENU_H */
{
struct color_table *cp = console_color_table+message_base_color;
unsigned int i;
+ unsigned int fga, bga;
unsigned int fgh, bgh;
+ unsigned int fg_idx, bg_idx;
+ unsigned int fg_rgb, bg_rgb;
static const unsigned int pc2rgb[8] =
{ 0x000000, 0x0000ff, 0x00ff00, 0x00ffff, 0xff0000, 0xff00ff, 0xffff00,
0xffffff };
- fg &= 0xff000000; /* Alpha only */
- bg &= 0xff000000; /* Alpha only */
+ /* Converting PC RGBI to sensible RGBA values is an "interesting"
+ proposition. This algorithm may need plenty of tweaking. */
+
+ fga = fg & 0xff000000;
+ fgh = ((fg >> 1) & 0xff000000) | 0x80000000;
- fgh = (0x80000000+(fg >> 1)) & 0xff000000;
- bgh = (0x80000000+(bg >> 1)) & 0xff000000;
+ bga = bg & 0xff000000;
+ bgh = ((bg >> 1) & 0xff000000) | 0x80000000;
for (i = 0; i < 256; i++) {
- cp->argb_fg = pc2rgb[i & 7] | ((i & 0x08) ? fgh : fg);
- cp->argb_bg = pc2rgb[(i >> 4) & 7] | ((i & 0x80) ? bgh : bg);
- cp->shadow = shadow;
+ fg_idx = i & 15;
+ bg_idx = i >> 4;
+
+ fg_rgb = pc2rgb[fg_idx & 7] & fg;
+ bg_rgb = pc2rgb[bg_idx & 7] & bg;
+
+ if (fg_idx & 8) {
+ /* High intensity foreground */
+ fg_rgb |= fgh;
+ } else {
+ fg_rgb |= fga;
+ }
+
+ if (bg_idx == 0) {
+ /* Default black background, assume transparent */
+ bg_rgb = 0;
+ } else if (bg_idx & 8) {
+ bg_rgb |= bgh;
+ } else {
+ bg_rgb |= bga;
+ }
+
+ cp->argb_fg = fg_rgb;
+ cp->argb_bg = bg_rgb;
+ cp->shadow = shadow;
cp++;
}
}
console_color_table = color_table;
console_color_table_size = NCOLORS+256;
- set_msg_colors_global(0xc0000000, 0x40000000, SHADOW_NORMAL);
+ set_msg_colors_global(MSG_COLORS_DEF_FG, MSG_COLORS_DEF_BG,
+ MSG_COLORS_DEF_SHADOW);
}
static char *
int (*draw_background)(const char *filename);
-static int hexval(char c)
+static int hexval(int c)
{
- if (c >= '0' || c <= '9')
+ if (c >= '0' && c <= '9')
return c-'0';
c |= 0x20;
- if (c >= 'a' || c <= 'f')
+ if (c >= 'a' && c <= 'f')
return c-'a'+10;
return 0;
}
cptr++;
}
+ } else if ((ep = looking_at(p, "msgcolor")) ||
+ (ep = looking_at(p, "msgcolour"))) {
+ unsigned int fg_mask = MSG_COLORS_DEF_FG;
+ unsigned int bg_mask = MSG_COLORS_DEF_BG;
+ enum color_table_shadow shadow = MSG_COLORS_DEF_SHADOW;
+
+ p = skipspace(ep);
+ if (*p) {
+ if (!looking_at(p, "*"))
+ fg_mask = parse_argb(&p);
+
+ p = skipspace(p);
+ if (*p) {
+ if (!looking_at(p, "*"))
+ bg_mask = parse_argb(&p);
+
+ p = skipspace(p);
+ switch (*p | 0x20) {
+ case 'n':
+ shadow = SHADOW_NONE;
+ break;
+ case 's':
+ shadow = SHADOW_NORMAL;
+ break;
+ case 'a':
+ shadow = SHADOW_ALL;
+ break;
+ case 'r':
+ shadow = SHADOW_REVERSE;
+ break;
+ default:
+ /* go with default */
+ break;
+ }
+ }
+ }
+ set_msg_colors_global(fg_mask, bg_mask, shadow);
} else {
/* Unknown, check for layout parameters */
struct menu_parameter *pp;