File tree 1 file changed +4
-2
lines changed
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]:
69
69
input_color_bytes = [
70
70
[int (_hex [i : i + 2 ], 16 ) for i in (1 , 3 , 5 )] for _hex in hexList
71
71
]
72
+ # to have the same output as the previous version of this function we use
73
+ # a resolution of 765 'indexes' per color bin.
72
74
resolution = 765
73
75
n_indexes = resolution * (len (hexList ) - 1 )
74
76
result : List [str ] = []
75
77
for counter in range (nColors - 1 ):
76
78
fraction_overall = float (counter ) / (nColors - 1 )
77
79
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
80
82
fraction = index_color_bin / (resolution - 1 )
81
83
start = input_color_bytes [idx_input ]
82
84
end = input_color_bytes [idx_input + 1 ]
You can’t perform that action at this time.
0 commit comments