mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-24 14:03:24 +01:00
Merge branch 'terminal_colors' of https://github.com/ooesili/toxic into ooesili-terminal_colors
This commit is contained in:
commit
4a8db6f098
22
configure.ac
22
configure.ac
@ -451,6 +451,28 @@ fi
|
|||||||
|
|
||||||
AM_CONDITIONAL(BUILD_AV, test "x$BUILD_AV" = "xyes")
|
AM_CONDITIONAL(BUILD_AV, test "x$BUILD_AV" = "xyes")
|
||||||
|
|
||||||
|
# check for ncurses default colour capabilities
|
||||||
|
NATIVE_COLOURS="no"
|
||||||
|
AC_ARG_ENABLE([native-colours],
|
||||||
|
[AC_HELP_STRING(
|
||||||
|
[--enable-native-colours], [use terminal-default fg/bg colours])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
if test "x$enableval" = "xno"; then
|
||||||
|
NATIVE_COLOURS="no"
|
||||||
|
elif test "x$enableval" = "xyes"; then
|
||||||
|
NATIVE_COLOURS="yes"
|
||||||
|
fi
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if test "x$NATIVE_COLOURS" = "xyes"; then
|
||||||
|
AC_CHECK_LIB([ncurses], [assume_default_colors],
|
||||||
|
[AC_DEFINE(
|
||||||
|
[TOXIC_NATIVE_COLOURS], [1], [use terminal-default fg/bg colours])
|
||||||
|
],
|
||||||
|
[AC_MSG_WARN([curses library does not support native colours])]
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
TOXIC_VERSION="$PACKAGE_VERSION"
|
TOXIC_VERSION="$PACKAGE_VERSION"
|
||||||
AC_PATH_PROG([GIT], [git], [no])
|
AC_PATH_PROG([GIT], [git], [no])
|
||||||
|
17
src/main.c
17
src/main.c
@ -108,14 +108,19 @@ static void init_term(void)
|
|||||||
timeout(100);
|
timeout(100);
|
||||||
|
|
||||||
if (has_colors()) {
|
if (has_colors()) {
|
||||||
|
short bg_color = COLOR_BLACK;
|
||||||
start_color();
|
start_color();
|
||||||
|
#ifdef TOXIC_NATIVE_COLOURS
|
||||||
|
if (assume_default_colors(-1,-1) == OK)
|
||||||
|
bg_color = -1;
|
||||||
|
#endif
|
||||||
init_pair(0, COLOR_WHITE, COLOR_BLACK);
|
init_pair(0, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(1, COLOR_GREEN, COLOR_BLACK);
|
init_pair(1, COLOR_GREEN, bg_color);
|
||||||
init_pair(2, COLOR_CYAN, COLOR_BLACK);
|
init_pair(2, COLOR_CYAN, bg_color);
|
||||||
init_pair(3, COLOR_RED, COLOR_BLACK);
|
init_pair(3, COLOR_RED, bg_color);
|
||||||
init_pair(4, COLOR_BLUE, COLOR_BLACK);
|
init_pair(4, COLOR_BLUE, bg_color);
|
||||||
init_pair(5, COLOR_YELLOW, COLOR_BLACK);
|
init_pair(5, COLOR_YELLOW, bg_color);
|
||||||
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
|
init_pair(6, COLOR_MAGENTA, bg_color);
|
||||||
init_pair(7, COLOR_BLACK, COLOR_BLACK);
|
init_pair(7, COLOR_BLACK, COLOR_BLACK);
|
||||||
init_pair(8, COLOR_BLACK, COLOR_WHITE);
|
init_pair(8, COLOR_BLACK, COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user