blob: bb9c057e10d8867d80411fe9970c027cf208cb51 [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
3 *
4 * This file may be distributed under the terms of the
5 * GNU Lesser General Public License.
6 */
7
8#include "colors.h"
9
10static int ul_color_term_ok;
11
12int colors_init(void)
13{
14 ul_color_term_ok = isatty(STDOUT_FILENO);
15 return ul_color_term_ok;
16}
17
18void color_enable(const char *color_scheme)
19{
20 if (ul_color_term_ok)
21 fputs(color_scheme, stdout);
22}
23
24void color_disable(void)
25{
26 if (ul_color_term_ok)
27 fputs(UL_COLOR_RESET, stdout);
28}