Skip to content

Commit a7f19fe

Browse files
committed
feat: configurable background color and optional background blur radius
1 parent 7f14abe commit a7f19fe

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/scripts/generate_showcase.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def get_texture(path, is_block):
5050

5151
return img
5252

53-
def create_background(width, height, override_path):
53+
def create_background(width, height, config):
54+
override_path = config.get("background_override")
5455
if override_path and os.path.exists(override_path):
5556
bg = Image.open(override_path).convert("RGBA")
5657
# Resize to fill, center crop
@@ -60,11 +61,16 @@ def create_background(width, height, override_path):
6061
left = (bg.width - width) / 2
6162
top = (bg.height - height) / 2
6263
bg = bg.crop((left, top, left + width, top + height))
63-
bg = bg.filter(ImageFilter.GaussianBlur(radius=5))
64+
65+
blur_radius = config.get("background_blur_radius", 5)
66+
if blur_radius > 0:
67+
bg = bg.filter(ImageFilter.GaussianBlur(radius=blur_radius))
6468
return bg
6569
else:
6670
# Default gradient (solid color as a fallback if no dynamic gen is wanted)
67-
bg = Image.new("RGBA", (width, height), (211, 140, 83, 255))
71+
color_arr = config.get("background_color", [211, 140, 83, 255])
72+
color = tuple(color_arr)
73+
bg = Image.new("RGBA", (width, height), color)
6874
return bg
6975

7076
def main():
@@ -85,7 +91,7 @@ def main():
8591
canvas_width = 1920
8692
canvas_height = 1080
8793

88-
bg = create_background(canvas_width, canvas_height, config.get("background_override"))
94+
bg = create_background(canvas_width, canvas_height, config)
8995

9096
try:
9197
inv_slot = Image.open(INV_SLOT_PATH).convert('RGBA')

.github/scripts/showcase_config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"title": "ViaBackwards-Plus Showcase",
33
"background_override": "../images/vbp_background.png",
4+
"background_blur_radius": 0,
5+
"background_color": [211, 140, 83, 255],
46
"transparent_inventory": true,
57
"items": [
68
{

0 commit comments

Comments
 (0)