How create a new colormap

Hello you all,
I want to create a new colormap based on my RGB fIle. And I want to add the new colormap to the afni gui. So I can use it when I open the afni and invoke the colormap. But how to do this?


Just to note, all the colorbars are listed here, in action:

To make a local colorbar (or “palette”), you can see what the format would look like as follows:

  • open the afni GUI
  • load some overlay or click on “Define Overlay”
  • right-click on the “Olay” above the colorbar image
  • select “write out palette”
  • git your colorscale some name/output prefix, such as “test_cbar”
  • then you can check out the created “test_cbar.pal” (again, the extension for “palette”), which will be a single column file; the first line contains the cbar/palette name, then there will be 256 hex values. For example, here is the first few lines of a cbar dumped out this way:


To read in a palette that exists as a *.pal file in the local directory, go back to the overlay menu and right-click the popular Olay button, and select “read in palette” from the dropdown menu—find your *.pal file from the presented list. Then rightclick on the existing colorbar image, and your loaded-in-colorbar should be waiting for you to select at the bottom of the list.

If you need a cbar with >256 colors, you can make one of either (exactly) 512, 1024 or 2048 colors—which means still a single column, but one containing 1 string label at the top and then, say, 1024 hex values. To load this beast, you must have started the GUI with the “-XXXnpanes 1024” option (or with whatever large power of 2 matches your cbar), and then do the usual rigamarole to load that in.

I’m just curious what colorbar you are interested in making—would you mind posting an image of it here? (To save an image of the presently-selected colorbar, return to the famous Olay button, rightclick it, and select “save pbar to image”.


Thank you for your reply, it helps me a lot. Actually, I noticed that the color in high-level journals is often low saturation and soft. However, the colorbars provided by afni have a high saturation, which makes the image dazzling. So I extracted the color of high-level journals and customized the color bar with low saturation. And I think it may look better to make such a picture. If afni can provide some lower saturation or better colorbars in the future, I think I will be happy to use it.

If the colors are too dazzling, you can lower the opacity of them—that is one reason they might be bright to start with, so they can take some opacity reduction to show structure underneath.

Happy to hear suggestions of “better” colorbars if you have some details of those, or if you could point to some example papers with such colorbars.