FreeDATA/gui/src/waterfall/make_colormap.py
2023-02-09 12:26:25 +00:00

14 lines
355 B
Python

#!/usr/bin/env python
import matplotlib.pyplot as plt
colormaps = ('viridis', 'inferno', 'magma', 'jet', 'binary')
for c in colormaps:
cmap_name = c
cmap = plt.get_cmap(cmap_name)
colors = [[int(round(255 * x)) for x in cmap(i)[:3]] for i in range(256)]
print(f'var {c} = {colors}')
print(f'var colormaps = [{", ".join(colormaps)}];')