-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
In [294]: import colorlover as cl
In [295]: cl
Out[295]: <module 'colorlover' from '/home/latty/.virtualenvs/screenpulse-unittest/local/lib/python2.7/site-packages/colorlover/__init__.pyc'>
In [296]: colormaps = cl.scales['7']['qual']['Dark2']
In [297]: colormaps
Out[297]:
['rgb(27,158,119)',
'rgb(217,95,2)',
'rgb(117,112,179)',
'rgb(231,41,138)',
'rgb(102,166,30)',
'rgb(230,171,2)',
'rgb(166,118,29)']
In [298]: cl.interp(colormaps, 11)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-298-946770f2b787> in <module>()
----> 1 cl.interp(colormaps, 11)
/home/latty/.virtualenvs/screenpulse-unittest/local/lib/python2.7/site-packages/colorlover/__init__.pyc in interp(scl, r)
1821 c_i = int(i*math.floor(SCL_FI)/round(r[-1])) # start color index
1822 hsl_o = rgb_to_hsl( scl[c_i] ) # convert rgb to hls
-> 1823 hsl_f = rgb_to_hsl( scl[c_i+1] )
1824 section_min = c_i*r[-1]/SCL_FI
1825 section_max = (c_i+1)*(r[-1]/SCL_FI)
IndexError: list index out of range
this bug is not stable, here for example:
In [310]: cl.interp(colormaps, 10)
Out[310]:
['hsl(162.0, 70.0%, 36.0%)',
'hsl(70.6666666667, 88.6666666667%, 40.0%)',
'hsl(72.3333333333, 75.3333333333%, 47.0%)',
'hsl(167.0, 30.0%, 57.0%)',
'hsl(275.0, 62.6666666667%, 54.3333333333%)',
'hsl(248.666666667, 75.6666666667%, 48.0%)',
'hsl(88.0, 69.0%, 38.0%)',
'hsl(58.6666666667, 88.3333333333%, 42.6666666667%)',
'hsl(29.3333333333, 107.666666667%, 47.3333333333%)',
'hsl(38.0, 70.0%, 38.0%)']
In [311]: cl.interp(colormaps, 11)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-311-946770f2b787> in <module>()
----> 1 cl.interp(colormaps, 11)
/home/latty/.virtualenvs/screenpulse-unittest/local/lib/python2.7/site-packages/colorlover/__init__.pyc in interp(scl, r)
1821 c_i = int(i*math.floor(SCL_FI)/round(r[-1])) # start color index
1822 hsl_o = rgb_to_hsl( scl[c_i] ) # convert rgb to hls
-> 1823 hsl_f = rgb_to_hsl( scl[c_i+1] )
1824 section_min = c_i*r[-1]/SCL_FI
1825 section_max = (c_i+1)*(r[-1]/SCL_FI)
IndexError: list index out of range
In [312]: cl.interp(colormaps, 15)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-312-e3b4fde92ac0> in <module>()
----> 1 cl.interp(colormaps, 15)
/home/latty/.virtualenvs/screenpulse-unittest/local/lib/python2.7/site-packages/colorlover/__init__.pyc in interp(scl, r)
1821 c_i = int(i*math.floor(SCL_FI)/round(r[-1])) # start color index
1822 hsl_o = rgb_to_hsl( scl[c_i] ) # convert rgb to hls
-> 1823 hsl_f = rgb_to_hsl( scl[c_i+1] )
1824 section_min = c_i*r[-1]/SCL_FI
1825 section_max = (c_i+1)*(r[-1]/SCL_FI)
IndexError: list index out of range
In [313]: cl.interp(colormaps, 16)
Out[313]:
['hsl(162.0, 70.0%, 36.0%)',
'hsl(107.2, 81.2%, 38.4%)',
'hsl(52.4, 92.4%, 40.8%)',
'hsl(-2.4, 103.6%, 43.2%)',
'hsl(110.2, 57.2%, 51.0%)',
'hsl(167.0, 30.0%, 57.0%)',
'hsl(223.8, 2.8%, 63.0%)',
'hsl(296.6, 69.2%, 53.8%)',
'hsl(361.4, 88.8%, 52.2%)',
'hsl(426.2, 108.4%, 50.6%)',
'hsl(88.0, 69.0%, 38.0%)',
'hsl(-8.4, 65.0%, 32.0%)',
'hsl(-104.8, 61.0%, 26.0%)',
'hsl(-201.2, 57.0%, 20.0%)',
'hsl(17.6, 115.4%, 49.2%)',
'hsl(0.0, 127.0%, 52.0%)']
Metadata
Metadata
Assignees
Labels
No labels