Skip to content

Commit c365224

Browse files
committed
force rgb colors to be a triplet of integers, not floats
1 parent 1f38da0 commit c365224

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plotly/tools.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4562,10 +4562,12 @@ def _endpts_to_intervals(endpts):
45624562
@staticmethod
45634563
def _convert_to_RGB_255(colors):
45644564
"""
4565-
Multiplies each element of a triplet by 255
4565+
Multiplies each element of a triplet by 255 and rounds to nearest int
45664566
"""
45674567

4568-
return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0)
4568+
return (int(colors[0]*255.0),
4569+
int(colors[1]*255.0),
4570+
int(colors[2]*255.0))
45694571

45704572
@staticmethod
45714573
def _n_colors(lowcolor, highcolor, n_colors):

0 commit comments

Comments
 (0)