File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,16 @@ def linear_gradient(hexList: List[str], nColors: int) -> List[str]:
6969 input_color_bytes = [
7070 [int (_hex [i : i + 2 ], 16 ) for i in (1 , 3 , 5 )] for _hex in hexList
7171 ]
72+ # to have the same output as the previous version of this function we use
73+ # a resolution of 765 'indexes' per color bin.
7274 resolution = 765
7375 n_indexes = resolution * (len (hexList ) - 1 )
7476 result : List [str ] = []
7577 for counter in range (nColors - 1 ):
7678 fraction_overall = float (counter ) / (nColors - 1 )
7779 index_overall = int (fraction_overall * (n_indexes - 1 ))
78- index_color_bin = index_overall % 765
79- idx_input = index_overall // 765
80+ index_color_bin = index_overall % resolution
81+ idx_input = index_overall // resolution
8082 fraction = index_color_bin / (resolution - 1 )
8183 start = input_color_bytes [idx_input ]
8284 end = input_color_bytes [idx_input + 1 ]
You can’t perform that action at this time.
0 commit comments