''
# https://iquilezles.org/articles/palettes/
import numpy as np
show = lambda img: __import__('PIL.Image').Image.fromarray(img)
W, H = 800, 40
imgs = []
for _ in range(20):
a, b, c, d = np.random.rand(4, 3)
# c = np.ones(3)
palette = lambda t: np.clip(a + b * np.cos(2 * np.pi * (c * t + d)), 0, 1)
line = [palette(t) for t in np.linspace(0, 1, W)]
img = np.stack([line] * H)
img = (img * 255).astype(np.uint8)
imgs.append(img)
img = np.vstack(imgs)
show(img)
''
a, b, c, d = np.array([
[.5, .5, .5],
[.5, .5, .5],
[1., 1., 1.],
[0., .33, .67]])
W, H = 800, 20
palette = lambda t: np.clip(a + b * np.cos(2 * np.pi * (c * t + d)), 0, 1)
line = [palette(t) for t in np.linspace(0, 1, W)]
img = (np.stack([line] * H) * 255).astype(np.uint8)
show(img)
''