Allow more drawing colors

This commit is contained in:
Jay McCarthy 2020-04-16 10:23:27 -04:00
parent 745eb82670
commit 9d82f2f8ad
3 changed files with 10 additions and 6 deletions

View File

@ -23,7 +23,10 @@
[blue . 4] [magenta . 5] [cyan . 6] [white . 7]
[brblack . 8] [brred . 9] [brgreen . 10] [bryellow . 11]
[brblue . 12] [brmagenta . 13] [brcyan . 14] [brwhite . 15]))
(define color/c (apply or/c #f (hash-keys symbol->color)))
(define color/c (apply or/c byte? #f (hash-keys symbol->color)))
(define (color->code c)
(if (byte? c) c
(hash-ref symbol->color c)))
(define (select-style* s)
(define (k s) (A:select-graphic-rendition (hash-ref symbol->style s)))
@ -31,11 +34,11 @@
(string-append (k 'normal) (k s))))
(define (select-text-color* c)
(if c
(A:select-xterm-256-text-color (hash-ref symbol->color c))
(A:select-xterm-256-text-color (color->code c))
(A:select-graphic-rendition A:style-default-text-color)))
(define (select-background-color* c)
(if c
(A:select-xterm-256-background-color (hash-ref symbol->color c))
(A:select-xterm-256-background-color (color->code c))
(A:select-graphic-rendition A:style-default-background-color)))
(define (make-terminal-buffer term-rows term-cols

View File

@ -76,8 +76,9 @@ screen content so only updates are output. }
A contract that recognizes the ASCII colors from the list
@racket['(black red green yellow blue magenta cyan white brblack brred
brgreen bryellow brblue brmagenta brcyan brwhite)]. The actual color
display depends on the terminal configuration. }
brgreen bryellow brblue brmagenta brcyan brwhite)], as well as any
@racket[byte?] value. The actual color display depends on the terminal
configuration. }
@defthing[style/c contract?]{

View File

@ -11,7 +11,7 @@
;;70 80 10 20
(matte 80 20
#:halign 'right
(fg 'blue
(fg 17
(frame #:fg 'red
(inset
4 5