summaryrefslogtreecommitdiff
path: root/guix/colors.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-10-08 19:24:34 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-10-08 19:24:34 +0200
commitd1f3b333e6176a7879ab3742bbebb2a99f61a528 (patch)
tree8bd82ce68bd2534a48bf13c7256997f82dd1b3f4 /guix/colors.scm
parente01d384efcdaf564bbb221e43b81e087c8e2af06 (diff)
parent861907f01efb1cae7f260e8cb7b991d5034a486a (diff)
downloadguix-patches-d1f3b333e6176a7879ab3742bbebb2a99f61a528.tar
guix-patches-d1f3b333e6176a7879ab3742bbebb2a99f61a528.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'guix/colors.scm')
-rw-r--r--guix/colors.scm18
1 files changed, 11 insertions, 7 deletions
diff --git a/guix/colors.scm b/guix/colors.scm
index 7949cf5763..b63ac37027 100644
--- a/guix/colors.scm
+++ b/guix/colors.scm
@@ -31,6 +31,8 @@
colorize-string
highlight
+ dim
+
color-rules
color-output?
isatty?*))
@@ -133,14 +135,16 @@ that subsequent output will not have any colors in effect."
(not (getenv "NO_COLOR"))
(isatty?* port)))
-(define %highlight-color (color BOLD))
+(define (coloring-procedure color)
+ "Return a procedure that applies COLOR to the given string."
+ (lambda* (str #:optional (port (current-output-port)))
+ "Return STR with extra ANSI color attributes if PORT supports it."
+ (if (color-output? port)
+ (colorize-string str color)
+ str)))
-(define* (highlight str #:optional (port (current-output-port)))
- "Return STR with extra ANSI color attributes to highlight it if PORT
-supports it."
- (if (color-output? port)
- (colorize-string str %highlight-color)
- str))
+(define highlight (coloring-procedure (color BOLD)))
+(define dim (coloring-procedure (color DARK)))
(define (colorize-matches rules)
"Return a procedure that, when passed a string, returns that string