[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/07: colors: Add 'dim'.
From: |
guix-commits |
Subject: |
01/07: colors: Add 'dim'. |
Date: |
Wed, 25 Sep 2019 09:49:54 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 0876e9c116125b28806286b0313ff78de5948562
Author: Ludovic Courtès <address@hidden>
Date: Wed Sep 25 10:45:38 2019 +0200
colors: Add 'dim'.
* guix/colors.scm (coloring-procedure): New procedure.
(%highlight-color): Remove.
(highlight): Define in terms of 'coloring-procedure'.
(dim): New procedure.
---
guix/colors.scm | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/guix/colors.scm b/guix/colors.scm
index 7949cf5..b63ac37 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
- branch master updated (dd2a832 -> 195854a), guix-commits, 2019/09/25
- 01/07: colors: Add 'dim'.,
guix-commits <=
- 02/07: pull: Dim the commit ID when displaying news., guix-commits, 2019/09/25
- 04/07: gnu: emacs-exwm: Update to 0.23., guix-commits, 2019/09/25
- 05/07: doc: Fix installing Guix in VM, guix-commits, 2019/09/25
- 06/07: doc: Avoid @verbatiminclude for Scheme snippets., guix-commits, 2019/09/25
- 03/07: doc: Support paren matching via CSS hover., guix-commits, 2019/09/25
- 07/07: gnu: Add r-assertable., guix-commits, 2019/09/25