File tree 1 file changed +5
-4
lines changed
packages/python/plotly/plotly/figure_factory
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import absolute_import , division
2
2
3
- from plotly import exceptions , optional_imports
4
3
import plotly .colors as clrs
4
+ from plotly import exceptions , optional_imports
5
5
from plotly .figure_factory import utils
6
6
from plotly .graph_objs import graph_objs
7
7
from plotly .validators .heatmap import ColorscaleValidator
@@ -147,9 +147,10 @@ def create_annotated_heatmap(
147
147
148
148
149
149
def to_rgb_color_list (color_str , default ):
150
- if "rgb" in color_str :
151
- return [int (v ) for v in color_str .strip ("rgb()" ).split ("," )]
152
- elif "#" in color_str :
150
+ color_str = color_str .strip ()
151
+ if color_str .startswith ("rgb" ):
152
+ return [int (v ) for v in color_str .strip ("rgba()" ).split ("," )]
153
+ elif color_str .startswith ("#" ):
153
154
return clrs .hex_to_rgb (color_str )
154
155
else :
155
156
return default
You can’t perform that action at this time.
0 commit comments