from PIL import Image import numpy as np stops = [ "#1e1e2e", "#eba0ac", "#f38ba8", "#fab387", "#f9e2af", "#a6e3a1", "#94e2d5", "#89dceb", "#74c7ec", "#89b4fa", "#b4befe", "#cdd6f4" ] def hex_to_rgb(h): return tuple(int(h[i:i+2], 16) for i in (1,3,5)) width, height = 256, 1 lut = Image.new("RGB", (width, height)) pixels = lut.load() n = len(stops) - 1 seg = width / n for x in range(width): i = min(int(x / seg), n-1) t = (x - i * seg) / seg c0, c1 = np.array(hex_to_rgb(stops[i])), np.array(hex_to_rgb(stops[i+1])) pixels[x,0] = tuple(np.round((1-t)*c0 + t*c1).astype(int)) lut.save("catppuccin_mocha_lut.png")