notcurses/python/notcurses-direct-pydemo
2020-10-07 18:37:59 -04:00

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()