mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
colors: Add 'highlight'.
* guix/colors.scm (%highlight-color): New variable. (highlight): New procedure. * guix/ui.scm (%highlight-argument)[highlight]: Remove. (%highlight-color): Remove.
This commit is contained in:
parent
a5c72da46c
commit
c1c5d68a94
2 changed files with 12 additions and 9 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue