Source code for schrodinger.application.msv.gui.color_ramp
"""
Color ramps for use in MSV color schemes.
"""
from schrodinger.structutils import color as sutil_color
[docs]class NamedColorRamp(sutil_color.ColorRamp):
"""
A color ramp with a name. This name is used to refer to the color ramp in
both the GUI and in JSON files.
"""
[docs] def __init__(self, name, *args, **kwargs):
"""
See parent class for additional method documentation.
:param name: The name of the color ramp.
:type name: str
"""
self._name = name
super().__init__(*args, **kwargs)
@property
def name(self):
return self._name
[docs]class NamedRainbowColorRamp(NamedColorRamp, sutil_color.RainbowColorRamp):
pass
BLUE_WHITE_RED = NamedColorRamp("Blue-White-Red", ("blue", "white", "red"),
(0, 50, 100))
RED_WHITE_BLUE = NamedColorRamp("Red-White-Blue", ("red", "white", "blue"),
(0, 50, 100))
RAINBOW = NamedRainbowColorRamp("Rainbow", 0, 100)
GREEN_RED = NamedColorRamp("Green-Red", ('green', 'red'), (0, 100))
RED_GREEN_VIOLET = NamedColorRamp("Red-Green-Violet",
((255, 30, 0), (55, 255, 0), (180, 0, 255)),
(0, 50, 100))
# A list of all color ramps, in the order they should appear in the combo box in
# the Define Custom Color Scheme dialog
ALL_RAMPS = [
BLUE_WHITE_RED, RED_WHITE_BLUE, RAINBOW, GREEN_RED, RED_GREEN_VIOLET
]
RAMP_BY_NAME = {ramp.name: ramp for ramp in ALL_RAMPS}
RAINBOW_RAMP_IDX = ALL_RAMPS.index(RAINBOW)
FIRST_RAMP_IDX = 0