Skip to content

Commit a414653

Browse files
committed
fix to_rgb_color_list when passing rgba colors (closes #3477)
1 parent df19fc7 commit a414653

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: packages/python/plotly/plotly/figure_factory/_annotated_heatmap.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, division
22

3-
from plotly import exceptions, optional_imports
43
import plotly.colors as clrs
4+
from plotly import exceptions, optional_imports
55
from plotly.figure_factory import utils
66
from plotly.graph_objs import graph_objs
77
from plotly.validators.heatmap import ColorscaleValidator
@@ -147,9 +147,10 @@ def create_annotated_heatmap(
147147

148148

149149
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("#"):
153154
return clrs.hex_to_rgb(color_str)
154155
else:
155156
return default

0 commit comments

Comments
 (0)