FreeDATA/gui/src/waterfall/make_colormap.py

14 lines
355 B
Python
Raw Normal View History

2021-07-17 09:05:50 +02:00
#!/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)
2023-02-09 13:26:25 +01:00
colors = [[int(round(255 * x)) for x in cmap(i)[:3]] for i in range(256)]
2021-07-17 09:05:50 +02:00
print(f'var {c} = {colors}')
print(f'var colormaps = [{", ".join(colormaps)}];')