diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-04-09 22:39:26 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-04-10 12:40:58 +0200 |
commit | 5d9f9ad63191646a22dc80624227aa413a4894f0 (patch) | |
tree | f1f7e017bc3bbd9465470712b835db4f0ef8d7c0 /guix/ui.scm | |
parent | 95207e70d561517c8db8992f61552004f8213b04 (diff) | |
download | guix-5d9f9ad63191646a22dc80624227aa413a4894f0.tar guix-5d9f9ad63191646a22dc80624227aa413a4894f0.tar.gz |
Add (guix colors).
* guix/colors.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/ui.scm (color-table, color, colorize-string): Remove.
* guix/status.scm (isatty?*, color-output? color-rules): Remove.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r-- | guix/ui.scm | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 0070301c47..c2807b711f 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -10,8 +10,6 @@ ;;; Copyright © 2016 Roel Janssen <roel@gnu.org> ;;; Copyright © 2016 Benz Schenk <benz.schenk@uzh.ch> ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com> -;;; Copyright © 2013, 2014 Free Software Foundation, Inc. -;;; Copyright © 2018 Sahithi Yarlagadda <sahi@swecha.net> ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> ;;; ;;; This file is part of GNU Guix. @@ -118,8 +116,7 @@ guix-warning-port warning info - guix-main - colorize-string)) + guix-main)) ;;; Commentary: ;;; @@ -1703,54 +1700,4 @@ and signal handling has already been set up." (initialize-guix) (apply run-guix args)) -(define color-table - `((CLEAR . "0") - (RESET . "0") - (BOLD . "1") - (DARK . "2") - (UNDERLINE . "4") - (UNDERSCORE . "4") - (BLINK . "5") - (REVERSE . "6") - (CONCEALED . "8") - (BLACK . "30") - (RED . "31") - (GREEN . "32") - (YELLOW . "33") - (BLUE . "34") - (MAGENTA . "35") - (CYAN . "36") - (WHITE . "37") - (ON-BLACK . "40") - (ON-RED . "41") - (ON-GREEN . "42") - (ON-YELLOW . "43") - (ON-BLUE . "44") - (ON-MAGENTA . "45") - (ON-CYAN . "46") - (ON-WHITE . "47"))) - -(define (color . lst) - "Return a string containing the ANSI escape sequence for producing the -requested set of attributes in LST. Unknown attributes are ignored." - (let ((color-list - (remove not - (map (lambda (color) (assq-ref color-table color)) - lst)))) - (if (null? color-list) - "" - (string-append - (string #\esc #\[) - (string-join color-list ";" 'infix) - "m")))) - -(define (colorize-string str . color-list) - "Return a copy of STR colorized using ANSI escape sequences according to the -attributes STR. At the end of the returned string, the color attributes will -be reset such that subsequent output will not have any colors in effect." - (string-append - (apply color color-list) - str - (color 'RESET))) - ;;; ui.scm ends here |