diff --git a/cmyt.arbre.pal b/cmyt.arbre.pal new file mode 100644 index 0000000..17ed57a --- /dev/null +++ b/cmyt.arbre.pal @@ -0,0 +1 @@ +qqrrsstuuvvwwxxyyzz{{||}}~~}|zywvtrqonljigedba_^\[YXWUTSRPONMLKJIHGFEDDCBAA@?>>=<<;::99876654432210//.--,++**))((((()))*+,-.013579;>@CEHKNQTWZ]adgknruy| !""#$%%&&'(())*++,,--..///00112223334455566778899::;<<=>?@ABDEFHIKMNPRTVXZ\^`bdfhjlnprtuwy{|~ "$'),.1368:=?BDGILNPSUXZ]_bdgilnqsvx{~~|zxusqnligdb_]ZXURPMKHEC@>;97421/-,,++,-/148<@Edddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd \ No newline at end of file diff --git a/mpl_colormap_to_pal.py b/mpl_colormap_to_pal.py new file mode 100755 index 0000000..5a4f2b0 --- /dev/null +++ b/mpl_colormap_to_pal.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +import argparse +import importlib + +import matplotlib as mpl +import numpy as np + +parser = argparse.ArgumentParser( + description="Generate Amrvis palette files from matplotlib colormaps." +) +parser.add_argument("cmap", nargs="+", help="the name of a matplotlib colormap") +parser.add_argument( + "--import", + action="append", + dest="extra_imports", + metavar="MODULE", + default=[], + help="module to import for additional colormaps", +) +args = parser.parse_args() +print(args) + +for name in args.extra_imports: + importlib.import_module(name) + +for cm_name in args.cmap: + cmap = mpl.colormaps.get_cmap(cm_name) + colors = cmap.resampled(256)(np.linspace(0, 1, 256)) + data = np.round(colors * (255, 255, 255, 100)).astype(np.uint8).T.reshape(-1) + filename = f"{cmap.name}.pal" + data.tofile(filename) + print(f"wrote palette to {filename}") diff --git a/viridis.pal b/viridis.pal new file mode 100644 index 0000000..3c9e9d8 --- /dev/null +++ b/viridis.pal @@ -0,0 +1,2 @@ +DDEEFFFFGGGGGHHHHHHHHHHHHHHHHHGGGGGFFFFEEEDDDCCBBBAA@@??>>>==<<;;::998877665544332211100//...--,,,++***)))(('''&&&%%%$$###"""!!!!  !!""#$%%&'()*,-./124578:;=?@BDFHJLNPRTVXZ\^`cegilnpsuwz| +  !#$%&()*,-./02345789:;=>?@ABDEFGHIJLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqqrstuvwxyz{|}~TVWYZ\]^`acdeghijlmnopqstuvwxyzz{|}~~~}||{zyyxwvutsrqponmlkjihgedcb`_^\[ZXWVTSQPNMKIHFECA@><;976420/-+)(&%#!  !#%dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd \ No newline at end of file