1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 00:53:27 +01:00

use toxic settings for colour theme instead of config flag

This commit is contained in:
Jfreegman 2014-04-12 03:10:01 -04:00
parent 4a8db6f098
commit a29136d6b7
3 changed files with 8 additions and 27 deletions

View File

@ -451,29 +451,6 @@ 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])
if test "x$GIT" != "xno"; then if test "x$GIT" != "xno"; then

View File

@ -110,10 +110,12 @@ static void init_term(void)
if (has_colors()) { if (has_colors()) {
short bg_color = COLOR_BLACK; short bg_color = COLOR_BLACK;
start_color(); start_color();
#ifdef TOXIC_NATIVE_COLOURS
if (user_settings->colour_theme == NATIVE_COLS) {
if (assume_default_colors(-1,-1) == OK) if (assume_default_colors(-1,-1) == OK)
bg_color = -1; bg_color = -1;
#endif }
init_pair(0, COLOR_WHITE, COLOR_BLACK); init_pair(0, COLOR_WHITE, COLOR_BLACK);
init_pair(1, COLOR_GREEN, bg_color); init_pair(1, COLOR_GREEN, bg_color);
init_pair(2, COLOR_CYAN, bg_color); init_pair(2, COLOR_CYAN, bg_color);

View File

@ -61,8 +61,10 @@ static void uset_time(struct user_settings *s, int val)
static void uset_alerts(struct user_settings *s, int val) static void uset_alerts(struct user_settings *s, int val)
{ {
/* alerts default on if invalid value */
s->alerts = val == ALERTS_DISABLED ? ALERTS_DISABLED : ALERTS_ENABLED; s->alerts = val == ALERTS_DISABLED ? ALERTS_DISABLED : ALERTS_ENABLED;
} }
static void uset_colours(struct user_settings *s, int val) static void uset_colours(struct user_settings *s, int val)
{ {
/* use default toxic colours if invalid value */ /* use default toxic colours if invalid value */