Extend ANSI module to support more colors and also background colors.

This commit is contained in:
Dominik Pantůček 2023-03-27 22:00:39 +02:00
parent 3e9b421f60
commit 1a35c65f1d
3 changed files with 68 additions and 5 deletions

View file

@ -269,7 +269,31 @@ It understands the following keywords:
* ```#:blue``` - blue text foreground color
* ```#:magenta``` - magenta text foreground color
* ```#:cyan``` - cyan text foreground color
* ```#:white``` - white (grey) text foreground color
* ```#:white``` or ```#:grey``` - white (grey) text foreground color
* ```#:brightblack``` or ```#:darkgrey```- dark grey (bright black) text foreground color
* ```#:brightred``` - bright red text foreground color
* ```#:brightgreen``` - bright green text foreground color
* ```#:brightyellow``` - bright yellow text foreground color
* ```#:brightblue``` - bright blue text foreground color
* ```#:brightmagenta``` or ```#:pink``` - pink (bright magenta) text foreground color
* ```#:brightcyan``` - bright cyan text foreground color
* ```#:brightwhite``` - bright white (real white) text foreground color
* ```#:bgblack``` - black text background color
* ```#:bgred``` - red text background color
* ```#:bggreen``` - green text background color
* ```#:bgyellow``` - yellow text background color
* ```#:bgblue``` - blue text background color
* ```#:bgmagenta``` - magenta text background color
* ```#:bgcyan``` - cyan text background color
* ```#:bgwhite``` or ```#:bggrey``` - white (grey) text background color
* ```#:bgbrightblack``` or ```#:darkgrey```- dark grey (bright black) text background color
* ```#:bgbrightred``` - bright red text background color
* ```#:bgbrightgreen``` - bright green text background color
* ```#:bgbrightyellow``` - bright yellow text background color
* ```#:bgbrightblue``` - bright blue text background color
* ```#:bgbrightmagenta``` or ```#:pink``` - pink (bright magenta) text background color
* ```#:bgbrightcyan``` - bright cyan text background color
* ```#:bgbrightwhite``` - bright white (real white) text background color
* ```#:default``` - reset all attributes to terminal defaults
* ```#:bold``` - bold font (and/or bright foreground color on some terminals)

View file

@ -60,6 +60,38 @@
(#:magenta . 35)
(#:cyan . 36)
(#:white . 37)
(#:grey . 37)
(#:brightblack . 90)
(#:darkgrey . 90)
(#:brightred . 91)
(#:brightgreen . 92)
(#:brightyellow . 93)
(#:brightblue . 94)
(#:brightmagenta . 95)
(#:pink . 95)
(#:brightcyan . 96)
(#:brightwhite . 97)
(#:bgblack . 40)
(#:bgred . 41)
(#:bggreen . 42)
(#:bgyellow . 43)
(#:bgblue . 44)
(#:bgmagenta . 45)
(#:bgcyan . 46)
(#:bgwhite . 47)
(#:bggrey . 47)
(#:bgbrightblack . 100)
(#:bgdarkgrey . 100)
(#:bgbrightred . 101)
(#:bgbrightgreen . 102)
(#:bgbrightyellow . 103)
(#:bgbrightblue . 104)
(#:bgbrightmagenta . 105)
(#:bgpink . 105)
(#:bgbrightcyan . 106)
(#:bgbrightwhite . 107)
(#:default . 0)
(#:bold . 1)))

View file

@ -40,7 +40,8 @@
(chicken base)
configuration
member-record
month)
month
ansi)
;; Returns a list of months where each month is a list containing:
;; * month (from month module)
@ -77,9 +78,15 @@
(define (member-calendar-entry->string e)
(if e
(if (member 'existing (cadr e))
"EEE"
" ")
" "))
(if (member 'suspended (cadr e))
(ansi-string #:bgdarkgrey " ") ; Suspended
(if (member 'destroyed (cadr e))
(ansi-string #:bgblack "~~~") ; Destroyed
(if (member 'student (cadr e))
(ansi-string #:bgyellow " ") ; Student
(ansi-string #:bggreen " ")))) ; Normal
" ") ; Nonexistent - should not happen
" ")) ; Nonexistent
;; Converts the calendar into a table where rows represent years and
;; contain the year in the first cell and 12 cells for months after