colors: Introduce a disjoint type and pre-compute ANSI escapes.
authorLudovic Courtès <ludo@gnu.org>
Thu, 11 Apr 2019 14:57:38 +0000 (16:57 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 11 Apr 2019 16:18:13 +0000 (18:18 +0200)
commit2569ef9dab4f796a75b8cdddd57d3be37b142036
tree34b527c015552944c1a6fd1bb855dd45e36084bc
parentc1df77e215b6e69dccbe781307836a3b962c5968
colors: Introduce a disjoint type and pre-compute ANSI escapes.

* guix/colors.scm (color-table, color): Remove.
(<color>): New record type.
(print-color): New procedure.
(define-color-table, color): New macros.
(color-codes->ansi): New procedure.
(%reset): New variable.
(colorize-string): Rewrite accordingly.
(color-rules): Adjust accordingly.
* guix/status.scm (print-build-event): Adjust to new 'colorize-string'
interface.
* guix/ui.scm (%highlight-argument): Likewise.
(%warning-colors, %info-colors, %error-colors, %hint-colors)
(%highlight-colors): Remove.
(%warning-color, %info-color, %error-color, %hint-color)
(%highlight-color): New variables.
guix/colors.scm
guix/status.scm
guix/ui.scm