shell: concept of palettes

This commit is contained in:
Kartik K. Agaram 2021-06-06 22:38:56 -07:00
parent 32487eb00c
commit b6e1cffd9b
1 changed files with 8 additions and 13 deletions

View File

@ -201,24 +201,19 @@
(for y r (< y ymax) (+= y side)
(for x r (< x xmax) (+= x side)
(circle_rainbow screen x y (- r 100) 10)))))))])
(Greys . [(define Greys
(map1 (fn(n) (+ n 15))
(seq 16)))])
(Pinks . [(define Pinks '(84 85 59 60 61
13 36 37 5 108))])
(palette . [(def (palette p i)
(nth (% i (len p)) p))])
(task . [(def (task screen keyboard)
(let (y c) '(0 0)
(while (< y (height screen))
(hline screen y (color c))
(hline screen y (palette Greys c))
(+= y 3)
(++ c))))])
(color . [(def (color i)
(let palette
# greyscale
# '(16 17 18 19 20 21 22 23
# 24 25 26 27 28 29 30 31)
# pink
'(13 5 36 37 59 60 61 84
85 108 132)
# pink sorted
'(84 85 59 60 61 13 36 37
5 108)
(nth (% i (len palette)) palette)))])
(main . [(def (main screen keyboard)
(task screen keyboard))])
))