diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-04-14 19:48:19 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-04-14 23:40:52 +0200 |
commit | c1c5d68a94e219d0e56d5dc0e0d6ed9b08076a30 (patch) | |
tree | 52906eba28ea4b35a11976aa65968fabc597bb81 /guix/colors.scm | |
parent | a5c72da46c302511ef77f02ed9725e701ab82687 (diff) |
colors: Add 'highlight'.
* guix/colors.scm (%highlight-color): New variable.
(highlight): New procedure.
* guix/ui.scm (%highlight-argument)[highlight]: Remove.
(%highlight-color): Remove.
Diffstat (limited to 'guix/colors.scm')
-rw-r--r-- | guix/colors.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/colors.scm b/guix/colors.scm index 30ad231dfe..7949cf5763 100644 --- a/guix/colors.scm +++ b/guix/colors.scm @@ -30,6 +30,7 @@ color? colorize-string + highlight color-rules color-output? isatty?*)) @@ -132,6 +133,15 @@ that subsequent output will not have any colors in effect." (not (getenv "NO_COLOR")) (isatty?* port))) +(define %highlight-color (color BOLD)) + +(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 (colorize-matches rules) "Return a procedure that, when passed a string, returns that string colorized according to RULES. RULES must be a list of tuples like: |