Skip to content

Commit

Permalink
getcolors used to return 255-based rgbs for white color if string, bu…
Browse files Browse the repository at this point in the history
…t vcs expects 100-based rgbs (#239)
  • Loading branch information
doutriaux1 authored Aug 29, 2017
1 parent dc1c718 commit 6806ddd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions tests/test_vcs_getcolors_white_rgb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import unittest
import vcs

class VCSGetcolors(unittest.TestCase):
def testGetColorsRGB(self):
for white_color in ["white","black","green","blue","pink","salmon","grey"]:
colors = vcs.getcolors([-0.5,-0.2,0.2,0.5], white=white_color)
for color in colors:
if isinstance(color,(list,tuple)):
r,g,b = color
self.assertTrue(r<=100.)
self.assertTrue(g<=100.)
self.assertTrue(b<=100.)

2 changes: 1 addition & 1 deletion vcs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ def getcolors(levs, colors=None, split=1, white="white"):
split = 1
# Take care of argument white
if isinstance(white, basestring):
white = genutil.colors.str2rgb(white)
white = [value/2.55 for value in genutil.colors.str2rgb(white)]

# Gets first and last value, and adjust if extensions
mn = levs[0]
Expand Down

0 comments on commit 6806ddd

Please sign in to comment.