1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

terminfo_max_colors()

This commit is contained in:
Witold Filipczyk 2017-11-21 15:36:28 +01:00
parent d8e749c0f4
commit 99058d53d7
3 changed files with 32 additions and 1 deletions

View File

@ -530,6 +530,31 @@ set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
} /* !utf8_io */ } /* !utf8_io */
#ifdef CONFIG_TERMINFO #ifdef CONFIG_TERMINFO
driver->opt.terminfo = get_cmd_opt_bool("terminfo"); driver->opt.terminfo = get_cmd_opt_bool("terminfo");
switch (terminfo_max_colors()) {
case 88:
#ifdef CONFIG_88_COLORS
driver->opt.color_mode = COLOR_MODE_88;
#else
driver->opt.color_mode = COLOR_MODE_16;
#endif
break;
case 256:
#ifdef CONFIG_256_COLORS
driver->opt.color_mode = COLOR_MODE_256;
#else
driver->opt.color_mode = COLOR_MODE_16;
#endif
break;
case 16:
case 8:
driver->opt.color_mode = COLOR_MODE_16;
break;
default:
driver->opt.color_mode = COLOR_MODE_MONO;
break;
}
#endif #endif
} }

View File

@ -60,3 +60,9 @@ terminfo_set_foreground(int arg)
{ {
return tiparm(set_a_foreground, arg); return tiparm(set_a_foreground, arg);
} }
int
terminfo_max_colors(void)
{
return max_colors;
}

View File

@ -8,5 +8,5 @@ char *terminfo_set_italics(int arg);
char *terminfo_set_underline(int arg); char *terminfo_set_underline(int arg);
char *terminfo_set_foreground(int arg); char *terminfo_set_foreground(int arg);
char *terminfo_set_background(int arg); char *terminfo_set_background(int arg);
int terminfo_max_colors(void);
#endif #endif