aboutsummaryrefslogtreecommitdiffstats
path: root/src/colors.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-03 14:25:00 +0200
committerMax Kellermann <max@duempel.org>2008-10-03 14:25:00 +0200
commit88af2c3ace0fa42dbb816cc9fe8c4b54ce89233a (patch)
treef637ddd9f06c52890ffffe4910d410d4dd36d520 /src/colors.c
parent3e70743f5061573a2d9fff2fe4b232f38653d12b (diff)
downloadmpd-88af2c3ace0fa42dbb816cc9fe8c4b54ce89233a.tar.gz
mpd-88af2c3ace0fa42dbb816cc9fe8c4b54ce89233a.tar.xz
mpd-88af2c3ace0fa42dbb816cc9fe8c4b54ce89233a.zip
colors: make color support optional at compile time
Default is colors disabled. Those who love colorful terminals have the option to enable it with --enable-colors.
Diffstat (limited to 'src/colors.c')
-rw-r--r--src/colors.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/colors.c b/src/colors.c
index 68c5b6007..0bcf2782c 100644
--- a/src/colors.c
+++ b/src/colors.c
@@ -18,7 +18,9 @@
#include "colors.h"
#include "i18n.h"
+#ifdef ENABLE_COLORS
#include "options.h"
+#endif
#include <assert.h>
#include <stdio.h>
@@ -53,10 +55,12 @@
#define NAME_ALERT "alert"
#define NAME_BGCOLOR "background"
+#ifdef ENABLE_COLORS
typedef struct {
short color;
short r,g,b;
} color_definition_entry_t;
+#endif
typedef struct {
const char *name;
@@ -79,6 +83,8 @@ static color_entry_t colors[COLOR_END] = {
[COLOR_STATUS_ALERT] = { NAME_ALERT, COLOR_BRIGHT_RED, A_BOLD },
};
+#ifdef ENABLE_COLORS
+
/* background color */
static short bg = COLOR_BLACK;
@@ -208,6 +214,7 @@ colors_assign(const char *name, const char *value)
return 0;
}
+
int
colors_start(void)
{
@@ -257,6 +264,7 @@ colors_start(void)
return 0;
}
+#endif
int
colors_use(WINDOW *w, enum color id)
@@ -269,15 +277,19 @@ colors_use(WINDOW *w, enum color id)
wattr_get(w, &attrs, &pair, NULL);
+#ifdef ENABLE_COLORS
if (options.enable_colors) {
/* color mode */
if (attrs != entry->attrs || (short)id != pair)
wattr_set(w, entry->attrs, id, NULL);
} else {
+#endif
/* mono mode */
if (attrs != entry->attrs)
wattrset(w, entry->attrs);
+#ifdef ENABLE_COLORS
}
+#endif
return 0;
}