Skip to content

Instantly share code, notes, and snippets.

@djallits
Created April 12, 2026 00:26
Show Gist options
  • Select an option

  • Save djallits/d6838b8839a7f41ff42b431ead25c52e to your computer and use it in GitHub Desktop.

Select an option

Save djallits/d6838b8839a7f41ff42b431ead25c52e to your computer and use it in GitHub Desktop.
Generate themed (catppuccin, ethereal, everforest, gruvbox, hackerman, kanagawa, matte-black, nord, osaka-jade, ristretto, rose-pine, tokyo-night) with variants (light/dark) 2560x1080 desktop wallpapers.
import os
import numpy as np
from PIL import Image, ImageEnhance, ImageFilter
# -----------------------------
# CONFIG
# -----------------------------
INPUT_IMAGE = "base.png"
OUTPUT_ROOT = "outputs"
SIZE = (2560, 1080)
os.makedirs(OUTPUT_ROOT, exist_ok=True)
base_name = os.path.splitext(os.path.basename(INPUT_IMAGE))[0]
# -----------------------------
# HELPERS
# -----------------------------
def hex_to_rgb(hex_color):
hex_color = hex_color.lstrip("#")
return np.array(tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4)))
def create_gradient_lut(colors):
stops = np.linspace(0, 255, len(colors)).astype(int)
lut = np.zeros((256, 3))
for i in range(len(colors) - 1):
start, end = stops[i], stops[i+1]
c1 = hex_to_rgb(colors[i])
c2 = hex_to_rgb(colors[i+1])
for j in range(start, end + 1):
t = (j - start) / max(1, (end - start))
lut[j] = (1 - t) * c1 + t * c2
return lut.astype(np.uint8)
def apply_gradient_map(image, lut):
gray = image.convert("L")
gray_np = np.array(gray)
colored = lut[gray_np]
return Image.fromarray(colored.astype(np.uint8))
# -----------------------------
# LIGHT / DARK ADJUSTMENTS
# -----------------------------
def adjust_light(image):
image = ImageEnhance.Brightness(image).enhance(1.18)
image = ImageEnhance.Contrast(image).enhance(0.92)
image = ImageEnhance.Color(image).enhance(1.05)
return image
def adjust_dark(image):
image = ImageEnhance.Brightness(image).enhance(0.82)
image = ImageEnhance.Contrast(image).enhance(1.25)
image = ImageEnhance.Color(image).enhance(0.95)
return image
def add_glow(image, intensity=0.1):
blur = image.filter(ImageFilter.GaussianBlur(radius=18))
return Image.blend(image, blur, intensity)
# -----------------------------
# TRUE LIGHT/DARK PALETTES
# (dark → light progression)
# -----------------------------
themes = {
"catppuccin": {
"light": ["#eff1f5", "#ccd0da", "#ea76cb", "#8839ef"],
"dark": ["#11111b", "#313244", "#cba6f7", "#f5c2e7"]
},
"gruvbox": {
"light": ["#fbf1c7", "#ebdbb2", "#d79921", "#b57614"],
"dark": ["#1d2021", "#3c3836", "#fabd2f", "#fe8019"]
},
"nord": {
"light": ["#eceff4", "#e5e9f0", "#81a1c1", "#5e81ac"],
"dark": ["#2e3440", "#3b4252", "#88c0d0", "#81a1c1"]
},
"tokyo-night": {
"light": ["#e1e2e7", "#c0caf5", "#7aa2f7", "#2ac3de"],
"dark": ["#1a1b26", "#24283b", "#7aa2f7", "#bb9af7"]
},
"rose-pine": {
"light": ["#faf4ed", "#e0def4", "#ebbcba", "#c4a7e7"],
"dark": ["#191724", "#26233a", "#eb6f92", "#f6c177"]
},
"everforest": {
"light": ["#fdf6e3", "#e6e2cc", "#a7c080", "#83c092"],
"dark": ["#2b3339", "#374145", "#83c092", "#a7c080"]
},
"kanagawa": {
"light": ["#f2ecbc", "#dcd7ba", "#7e9cd8", "#98bb6c"],
"dark": ["#1f1f28", "#2a2a37", "#7e9cd8", "#957fb8"]
},
"matte-black": {
"light": ["#f5f5f5", "#cccccc", "#888888", "#444444"],
"dark": ["#000000", "#121212", "#2a2a2a", "#555555"]
},
"hackerman": {
"light": ["#eaffea", "#b7ffb7", "#33ff99", "#00cc66"],
"dark": ["#000000", "#001a00", "#00ff00", "#00cc66"]
},
"osaka-jade": {
"light": ["#eafff7", "#cafff0", "#5fffd7", "#00a86b"],
"dark": ["#001a1a", "#003333", "#00a86b", "#5fffd7"]
},
"ristretto": {
"light": ["#f5e6d3", "#e6ccb2", "#c9a27e", "#8c5a3c"],
"dark": ["#1a1412", "#2a1f1d", "#8c5a3c", "#c9a27e"]
},
"ethereal": {
"light": ["#ffffff", "#e6f7ff", "#a3d5ff", "#6bbcff"],
"dark": ["#0f1220", "#1c1f3a", "#5b6cff", "#9aa8ff"]
}
}
# -----------------------------
# PROCESS
# -----------------------------
base = Image.open(INPUT_IMAGE).resize(SIZE)
for theme_name, variants in themes.items():
for mode, palette in variants.items():
lut = create_gradient_lut(palette)
img = apply_gradient_map(base, lut)
if mode == "light":
img = adjust_light(img)
img = add_glow(img, 0.08)
else:
img = adjust_dark(img)
img = add_glow(img, 0.12)
output_dir = os.path.join(OUTPUT_ROOT, theme_name, mode)
os.makedirs(output_dir, exist_ok=True)
filename = f"{base_name}.png"
path = os.path.join(output_dir, filename)
img.save(path)
print(f"Saved: {path}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment