-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathansi.scm
31 lines (26 loc) · 828 Bytes
/
ansi.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;;
;;; Ansi terminal colours.
;;; https://github.com/codecop/assert-scm
;;; Copyright (c) 2015, Peter Kofler, BSD 3-Clause License
;;;
(define ansi-black "30")
(define ansi-red "31")
(define ansi-green "32")
(define ansi-yellow "33")
(define ansi-blue "34")
(define ansi-magenta "35")
(define ansi-cyan "36")
(define ansi-white "37")
(define ansi-off "0")
(define (-ansi-control-char code)
(string-append "\033" "[" code "m"))
(define (ansi-string-with-color colour s)
(string-append (-ansi-control-char colour)
s
(-ansi-control-char ansi-off)))
(define (ansi-error s)
(ansi-string-with-color ansi-red s))
(define (ansi-warning s)
(ansi-string-with-color ansi-yellow s))
;; (display (ansi-error "abc"))
;; (display (ansi-warning "abc"))