rordenlab / MRIcroGL

v1.2 GLSL volume rendering. Able to view NIfTI, DICOM, MGH, MHD, NRRD, AFNI format images.
https://www.nitrc.org/plugins/mwiki/index.php/mricrogl:MainPage
Other
204 stars 32 forks source link

colorbarcolor #31

Closed neurolabusc closed 2 years ago

neurolabusc commented 2 years ago

Latest commit includes enhancement suggested by Brandon Gunasekera to change the colorbar color and translucency.

The new command colorbarcolor(R,G,B,A) allows you to set the color and transparency of the color bar. The text on the colorbar will be white if the specified colorbar luminance is dark, otherwise the text will be black.

Be aware that the command resetdefaults() always sets your colorbar to opaque black (as if the script included the command colorbarcolor(0,0,0,255)), so if you want to reset defaults and set a custom colorbar color, you need to consider the order of these two commands.

This example script sets a translucent red color bar:

import gl
gl.resetdefaults()
gl.loadimage('spm152')
gl.colorbarcolor(255,0,0,160)

The Color/Colobar menu allows the user to choose from four default options. The equivalent script commands are:

This function will be included in the next release. To test compile from code.