-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
listing colortable for "export" #16
Comments
Hi @teuben, great to see you like the CMasher colormaps. To obtain the RGB values of a colormap, you can simply do Having said that, CMasher provides source files for all colormaps in this directory. However, I do have a question: What is the purpose of the file you linked? PS: Checking for the name of an MPL colormap first and then checking if CMasher has one with that name, is a bit dangerous. |
the reason for the script is that I have a non-python programs that then can use this table. For example for this script you can read that example rainforest.rgb into ds9 using color -> colormap parameters -> file -> load colormap PS The way I wrote the script, I believe "ocean" will catch the native one, if the user would want the cmr.ocean, they would need to supply the full name. |
If you want a simple 3 column ASCII file, then simply do the following: rgb = cmap(np.arange(cmap.N))[:, :3]
np.savetxt("path/to/file.txt", rgb, fmt='%.8f') or (if you want 8-bit RGB values): rgb = cmap(np.arange(cmap.N))[:, :3]
rgb_8bit = np.rint(rgb*255)
np.savetxt("path/to/file.txt", rgb_8bit, fmt='%i') In case you specifically want it printed, replace As I am already providing the RGB values of all colormaps in CMasher in separate text files (both with normalized floats and 8-bit values), I am not entirely sure what more I can do.
Correct, which is why I am warning about it. |
@teuben In the cli_tools branch, I am working on adding CLI tools to CMasher. |
I use RGB text tables in NEMO, 3 columns, and I believe ds9 as well. So for the community it would be useful to have some kind of script that does:
mkrgbtable cmr.rainforest > rainforest.rgb
I know they are also deep inside the python tree. I wrote something that might be of some use to clean up a but and feel feel to adopt that one. Mine is called mklut in NEMO, e.g..
https://github.com/teuben/nemo/blob/master/data/lut/mklut
As you will see from mine, I also support the generic MPL names, as well as yours, in the cmr. namespace.
The text was updated successfully, but these errors were encountered: