MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / get_color

Function get_color

colormap.py:7–18  ·  view source on GitHub ↗
(colorscale_name, loc)

Source from the content-addressed store, hash-verified

5
6
7def get_color(colorscale_name, loc):
8 from _plotly_utils.basevalidators import ColorscaleValidator
9 # first parameter: Name of the property being validated
10 # second parameter: a string, doesn't really matter in our use case
11 cv = ColorscaleValidator("colorscale", "")
12 # colorscale will be a list of lists: [[loc1, "rgb1"], [loc2, "rgb2"], ...]
13 colorscale = cv.validate_coerce(colorscale_name)
14
15 if hasattr(loc, "__iter__"):
16 intermediate_colors = [get_continuous_color(colorscale, x) for x in loc]
17 return intermediate_colors
18 return get_continuous_color(colorscale, loc)
19
20def get_continuous_color(colorscale, intermed):
21 """

Callers 1

get_plotly_colorsFunction · 0.85

Calls 1

get_continuous_colorFunction · 0.85

Tested by

no test coverage detected