mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
34 lines
619 B
Python
Executable File
34 lines
619 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import locale
|
|
from notcurses import notcurses
|
|
|
|
def print_b(nc, r, g, total):
|
|
b = total - (r + g)
|
|
if b > 255:
|
|
return 0
|
|
ret = nc.setFgRGB8(r, g, b)
|
|
print('X', end='')
|
|
|
|
def print_gb(nc, r, total):
|
|
g = 0
|
|
while g <= total - r and g < 256:
|
|
print_b(nc, r, g, total)
|
|
g += 4
|
|
|
|
def print_rgb(nc, total):
|
|
r = 0
|
|
while r < 256 and r < total:
|
|
print_gb(nc, r, total)
|
|
r += 1
|
|
|
|
def demo():
|
|
nc = notcurses.Ncdirect()
|
|
nc.cursorDisable()
|
|
for t in range(768):
|
|
print_rgb(nc, t);
|
|
print()
|
|
|
|
locale.setlocale(locale.LC_ALL, "")
|
|
demo()
|