You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notcurses/cffi/ncdirect-pydemo

37 lines
698 B
Python

#!/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()
try:
nc.cursorDisable()
except RuntimeError:
print("Couldn't disable cursor")
for t in range(768):
print_rgb(nc, t);
print()
locale.setlocale(locale.LC_ALL, "")
demo()