Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CCL = [27.07510258707097, 34.38502265503816, 42.02402843768756, 49.50112987272844, 57.173277387157796, 65.74123652910247, 74.82268281895817, 83.32566595929231]
- l1, a1, b1 = grf.to_spectra(*self.c1).to('lab').values
- l2, a2, b2 = grf.to_spectra(*self.c2).to('lab').values
- lscale = (l2 - l1) / (CCL[-1] - CCL[0])
- palette = []
- mcol = lambda x: max(min(int(x * 255. + .5), 255), 0)
- for i in range(8):
- f = i / 7.
- c = spectra.lab(
- l1 + (CCL[i] - CCL[0]) * lscale,
- a2 * f + a1 * (1 - f),
- b2 * f + b1 * (1 - f),
- )
- r, g, b = c.to('rgb').values
- rgb = (mcol(r), mcol(g), mcol(b))
- palette.append(rgb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement