Skip to content

Commit 2299a26

Browse files
committed
cow2 edits on _unconvert_from_RGB_255
1 parent d76b27e commit 2299a26

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

plotly/tools.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,11 +3220,9 @@ def _unconvert_from_RGB_255(colors):
32203220
a value between 0 and 1
32213221
32223222
"""
3223-
un_rgb_color = (colors[0]/(255.0),
3224-
colors[1]/(255.0),
3225-
colors[2]/(255.0))
3226-
3227-
return un_rgb_color
3223+
return (colors[0]/(255.0),
3224+
colors[1]/(255.0),
3225+
colors[2]/(255.0))
32283226

32293227
@staticmethod
32303228
def _map_face2color(face, colormap, vmin, vmax):
@@ -4562,12 +4560,15 @@ def _endpts_to_intervals(endpts):
45624560
@staticmethod
45634561
def _convert_to_RGB_255(colors):
45644562
"""
4565-
Multiplies each element of a triplet by 255 and rounds to floor int
4563+
Multiplies each element of a triplet by 255
4564+
4565+
Each coordinate of the color tuple is rounded to the nearest float and
4566+
then is turned into an integer
45664567
"""
45674568

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

45724573
@staticmethod
45734574
def _n_colors(lowcolor, highcolor, n_colors):

0 commit comments

Comments
 (0)