diff --git a/papers/color.py b/papers/color.py index 23871e0..3139557 100644 --- a/papers/color.py +++ b/papers/color.py @@ -1,4 +1,6 @@ -# display +""" +Small code to handle colored text +""" bold = '\033[1m' end = '\033[0m' @@ -18,7 +20,19 @@ normal = grey citekey = purple filepath = cyan -def colored(s, color=end, bold=False): +def dye(s, color=end, bold=False): + assert color[0] == '\033' if bold: s = '\033[1' + s[3:] return color + s + end + +_dye = dye +def _nodye(s, **kwargs): + return s + +def color_setup(config): + global dye + if config.getboolean(configs.MAIN_SECTION, 'color'): + dye = _dye + else: + dye = _nodye \ No newline at end of file