-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pan-pride.rkt
107 lines (101 loc) · 2.41 KB
/
.pan-pride.rkt
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#lang racket ; -*- racket -*-
(define gay
'((228 003 003) ; red
(255 140 000) ; orange
(255 237 000) ; yellow
(000 128 038) ; green
(000 077 255) ; blue
(117 007 135) ; purple
))
(define lesbian
'((163 002 098) ; red
(211 098 164) ; orange
(255 255 255) ; white
(255 154 086) ; pink
(213 045 000) ; purple
))
(define trans
'((091 206 250) ; blue
(245 169 184) ; pink
(255 255 255) ; white
(245 169 184) ; pink
(091 206 250) ; blue
))
(define enby
'((255 244 048) ; yellow
(255 255 255) ; white
(156 089 209) ; purple
(000 000 000) ; black
))
(define bi
'((214 002 112) ; pink
(214 002 112) ; pink
(155 079 150) ; purple
(000 056 168) ; blue
(000 056 168) ; blue
))
(define pan
'((255 033 140) ; pink
(255 216 000) ; yellow
(033 177 255) ; blue
))
(define queer
'((181 126 220) ; purple
(255 255 255) ; white
(074 129 035) ; green
))
(define ace
'((000 000 000) ; black
(169 163 163) ; grey
(255 255 255) ; white
(128 000 128) ; purple
))
(define old
'((255 105 180) ; pink
(255 000 000) ; red
(255 142 000) ; orange
(255 255 000) ; yellow
(000 142 000) ; green
(000 192 192) ; blue
(064 000 152) ; indigo
(142 000 142) ; purple
))
(define rainbow gay)
(define pride
(append
'((000 000 000) ; black
(120 079 023) ; brown
) rainbow))
;;; Fill a row with colour
(define (display-colour colour columns)
(printf "\e[48;2;~A;~A;~Am~a\e[0m~%"
(car colour) ; Red
(cadr colour) ; Green
(caddr colour) ; Blue
(make-string columns #\space)))
(define (display-pride flag rows columns)
(unless (null? flag)
(for ((_ rows))
(display-colour (car flag) columns))
(display-pride (cdr flag) rows columns)))
(define-syntax ->>
(syntax-rules ()
((_ val)
val)
((_ val (fun args ...) rest ...)
(->> (fun args ... val) rest ...))
((_ val fun rest ...)
(->> (fun val) rest ...))))
(define (get-screen-size)
(->> (thunk (system "stty size"))
with-output-to-string
string-normalize-spaces
string-split
(map string->number)
(apply values)))
(module+ main
(unless (getenv "COLORTERM")
(error "Sorry baby, your terminal does not support true colour.")
(exit -1))
(let-values (((rows columns) (get-screen-size)))
(display-pride pan 5 columns)))