This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch main
in repository eclair.

View the commit online.

commit 91c965be291d31f3502da8b47eba91958a3ca15b
Author: Alastair Poole <[email protected]>
AuthorDate: Sat Nov 21 17:21:01 2026 +0000

    themes: fix shadow cast
---
 data/themes/common/shadows.edc               |  11 +--
 data/themes/default/images/shadow_body.png   | Bin 6874 -> 12037 bytes
 data/themes/folio/images/shadow_body.png     | Bin 8893 -> 15071 bytes
 data/themes/frequency/images/shadow_body.png | Bin 8168 -> 13250 bytes
 data/themes/gant/images/shadow_body.png      | Bin 6381 -> 7897 bytes
 data/themes/nocturne/images/shadow_body.png  | Bin 7443 -> 14256 bytes
 data/themes/undertow/images/shadow_body.png  | Bin 9900 -> 17406 bytes
 data/themes/voltage/images/shadow_body.png   | Bin 8177 -> 9077 bytes
 src/bin/theme-shadows.py                     | 113 +++++++++++++--------------
 9 files changed, 59 insertions(+), 65 deletions(-)

diff --git a/data/themes/common/shadows.edc b/data/themes/common/shadows.edc
index c159609..6369c10 100644
--- a/data/themes/common/shadows.edc
+++ b/data/themes/common/shadows.edc
@@ -1,17 +1,14 @@
-/* Silhouette shadows continue under rounded corners, without rectangular clips.
- * PNGs use 2x resolution and fixed nine-patch corners; see tools/theme-shadows.py.
+/* Each PNG matches the fixed player silhouette at 2x.
+ * Regenerate with src/bin/theme-shadows.py.
  */
 part {
    name: "body_drop"; type: IMAGE; scale: 1; mouse_events: 0;
    description {
       state: "default" 0.0; offset_scale: 1;
       color: 255 255 255 255;
-      rel1 { relative: 0 0; offset: -27 -14; to: "body"; }
-      rel2 { relative: 1 1; offset: 29 27; to: "player_surface"; }
+      rel1 { relative: 0 0; offset: 0 0; }
+      rel2 { relative: 1 1; offset: -1 -1; }
       image.normal: "shadow_body.png";
-      image.border: 96 96 96 96;
-      image.border_scale: 1;
-      image.border_scale_by: 0.5;
       fill.smooth: 1;
    }
 }
diff --git a/data/themes/default/images/shadow_body.png b/data/themes/default/images/shadow_body.png
index 91921f8..597279e 100644
Binary files a/data/themes/default/images/shadow_body.png and b/data/themes/default/images/shadow_body.png differ
diff --git a/data/themes/folio/images/shadow_body.png b/data/themes/folio/images/shadow_body.png
index 3d12ff1..4b71efd 100644
Binary files a/data/themes/folio/images/shadow_body.png and b/data/themes/folio/images/shadow_body.png differ
diff --git a/data/themes/frequency/images/shadow_body.png b/data/themes/frequency/images/shadow_body.png
index d2d1ae2..90f235b 100644
Binary files a/data/themes/frequency/images/shadow_body.png and b/data/themes/frequency/images/shadow_body.png differ
diff --git a/data/themes/gant/images/shadow_body.png b/data/themes/gant/images/shadow_body.png
index f991da9..edbab39 100644
Binary files a/data/themes/gant/images/shadow_body.png and b/data/themes/gant/images/shadow_body.png differ
diff --git a/data/themes/nocturne/images/shadow_body.png b/data/themes/nocturne/images/shadow_body.png
index e62a85e..3570c2d 100644
Binary files a/data/themes/nocturne/images/shadow_body.png and b/data/themes/nocturne/images/shadow_body.png differ
diff --git a/data/themes/undertow/images/shadow_body.png b/data/themes/undertow/images/shadow_body.png
index 4d9ff82..3de8e28 100644
Binary files a/data/themes/undertow/images/shadow_body.png and b/data/themes/undertow/images/shadow_body.png differ
diff --git a/data/themes/voltage/images/shadow_body.png b/data/themes/voltage/images/shadow_body.png
index 4fa0eb2..37a84b5 100644
Binary files a/data/themes/voltage/images/shadow_body.png and b/data/themes/voltage/images/shadow_body.png differ
diff --git a/src/bin/theme-shadows.py b/src/bin/theme-shadows.py
index 1be71af..e9c0b9e 100644
--- a/src/bin/theme-shadows.py
+++ b/src/bin/theme-shadows.py
@@ -1,73 +1,70 @@
 #!/usr/bin/env python3
-"""Bake Flat-style shadows around theme silhouettes (requires Pillow and rsvg-convert).
+"""Bake the fixed player silhouettes at 2x (requires Pillow and rsvg-convert).
 
-Generated PNGs are checked in; building Eclair needs neither tool. Unlike
-Flat's rectangular compositor clips, these shadows continue beneath rounded
-corners. Nine-patch borders preserve their softness when panels resize.
+The generated PNGs are checked in so building Eclair needs neither tool.
 """
 from io import BytesIO
 from pathlib import Path
-import subprocess
 import re
-from PIL import Image, ImageChops, ImageDraw, ImageFilter
+import subprocess
 
-ROOT = Path(__file__).resolve().parents[1] / 'data/themes'
+from PIL import Image, ImageChops, ImageFilter
+
+ROOT = Path(__file__).resolve().parents[2] / 'data/themes'
+
+# Blur radius in logical pixels, downward offset, and peak opacity.
+PROFILES = {
+    'default': (6, 7, 128),
+    'gant': (4, 5, 134),
+    'nocturne': (6, 6, 155),
+    'folio': (7, 5, 112),
+    'frequency': (5, 6, 144),
+    'voltage': (2, 2, 142),
+    'undertow': (7, 7, 148),
+}
 
 
-def alpha(directory, name):
-    source = directory / (name + '.svg')
-    w, h = map(int, re.search(r'width="(\d+)" height="(\d+)"', source.read_text()).groups())
+def alpha(directory, name, width, height):
     return Image.open(BytesIO(subprocess.check_output([
-        'rsvg-convert', '-w', str(w * 2), '-h', str(h * 2),
-        str(source)]))).convert('RGBA').getchannel('A')
+        'rsvg-convert', '-w', str(width * 2), '-h', str(height * 2),
+        str(directory / f'{name}.svg')]))).convert('RGBA').getchannel('A')
 
 
-def build(root, theme):
-    directory = root / theme / 'images'
-    silhouette = alpha(directory, 'body')
-    # Side grips protrude beyond the body. Bake their actual SVG outlines into
-    # the same mask so the outer edge, rather than the body seam, casts a shadow.
-    grips = []
-    for side in ('left', 'right'):
-        parts = (root / theme / 'parts' / f'{side}_side_front.edc').read_text()
-        offsets = re.findall(r'offset:\s*(-?\d+)\s+(-?\d+);', parts)
-        x, y = map(int, offsets[0])
-        right, bottom = map(int, offsets[1])
-        grip = alpha(directory, f'{side}_border').resize(
-            ((right - x + 1) * 2, (bottom - y + 1) * 2), Image.Resampling.LANCZOS)
-        grips.append((x, y, grip))
-    # Built-in grips extend six logical pixels left and nine right.
-    complete = Image.new('L', (silhouette.width + 30, silhouette.height))
-    complete.paste(silhouette, (12, 0))
-    for x, y, grip in grips:
-        layer = Image.new('L', complete.size)
-        layer.paste(grip, (x * 2 + 12, y * 2))
-        complete = ImageChops.lighter(complete, layer)
-    silhouette = complete
-    for name in ('body', 'artwork', 'drawer'):
-        if name == 'body':
-            mask = silhouette
-        elif name == 'drawer':
-            background = "" 'playlist_background')
-            footer = alpha(directory, 'playlist_bottom')
-            mask = Image.new('L', (background.width, background.height + footer.height))
-            mask.paste(background, (0, 0))
-            mask.paste(footer, (0, background.height))
-        else:
-            # Canonical artwork panel; only the centre stretches at runtime.
-            mask = Image.new('L', (400, 280))
-            ImageDraw.Draw(mask).rounded_rectangle((0, 0, 399, 279),
-                                                  radius=16,
-                                                  fill=255)
-        shadow = Image.new('L', (mask.width + 84, mask.height + 84))
-        # Flat's 21/14/28 margins, 7px downward displacement and soft black mask.
-        shadow.paste(mask, (42, 42))
-        shadow = shadow.filter(ImageFilter.GaussianBlur(12)).point(lambda a: a // 2)
-        image = Image.new('RGBA', shadow.size)
-        image.putalpha(shadow)
-        image.save(directory / f'shadow_{name}.png', optimize=True)
+def build(theme, blur, offset, opacity):
+    directory = ROOT / theme / 'images'
+    width, body_height = map(int, re.search(
+        r'width="(\d+)" height="(\d+)"', (directory / 'body.svg').read_text()
+    ).groups())
+    window_width, window_height = map(int, re.search(
+        r'min: (\d+) (\d+);', (directory.parent / f'{theme}.edc').read_text()
+    ).groups())
+
+    # The full surface starts 14 px down and ends 28 px above the window bottom.
+    surface = alpha(directory, 'body', width, window_height - 14 - 28)
+    mask = Image.new('L', (window_width * 2, window_height * 2))
+    origin = (window_width - width, 14 * 2)
+    mask.paste(surface, origin)
+
+    # The playback panel sits over the taller surface and can fill its corners.
+    front = Image.new('L', mask.size)
+    front.paste(alpha(directory, 'body', width, body_height), origin)
+    mask = ImageChops.lighter(mask, front)
+
+    cast = Image.new('L', mask.size)
+    cast.paste(mask, (0, offset * 2))
+    cast = cast.filter(ImageFilter.GaussianBlur(blur * 2))
+    cast = cast.point(lambda value: value * opacity // 255)
+
+    # A close, undisplaced shadow follows the SVG's rounded or chamfered edge
+    # even where the softer cast shadow extends into the corner.
+    contact = mask.filter(ImageFilter.GaussianBlur(2))
+    contact = contact.point(lambda value: value * opacity // (3 * 255))
+
+    image = Image.new('RGBA', mask.size)
+    image.putalpha(ImageChops.screen(cast, contact))
+    image.save(directory / 'shadow_body.png', optimize=True)
 
 
 if __name__ == '__main__':
-    for theme in ('default', 'gant', 'nocturne', 'folio', 'frequency', 'voltage', 'undertow'):
-        build(ROOT, theme)
+    for theme, profile in PROFILES.items():
+        build(theme, *profile)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to