From 1358485f2be048eae36dcc35624f275cdef0de59 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Tue, 7 Apr 2026 10:15:38 +0300 Subject: [PATCH] fix logo wallpaper --- bible | 2 +- .../hooks/normal/9001-wallpaper.hook.chroot | 137 ++++++++++++------ 2 files changed, 90 insertions(+), 49 deletions(-) diff --git a/bible b/bible index 1d89a49..688b87e 160000 --- a/bible +++ b/bible @@ -1 +1 @@ -Subproject commit 1d89a4918e6d4b42847e6dbeccbcc40b091a8369 +Subproject commit 688b87e98deed5fadd71e10e123073640d92c15a diff --git a/iso/builder/config/hooks/normal/9001-wallpaper.hook.chroot b/iso/builder/config/hooks/normal/9001-wallpaper.hook.chroot index b22c25a..1342dc8 100755 --- a/iso/builder/config/hooks/normal/9001-wallpaper.hook.chroot +++ b/iso/builder/config/hooks/normal/9001-wallpaper.hook.chroot @@ -5,69 +5,110 @@ echo "=== generating bee wallpaper ===" mkdir -p /usr/share/bee python3 - <<'PYEOF' -from PIL import Image, ImageDraw, ImageFont +from PIL import Image, ImageDraw, ImageFont, ImageFilter import os W, H = 1920, 1080 -LOGO = """\ - \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 - \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u255a\u2588\u2588\u2557 \u2588\u2588\u2554\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d - \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u255a\u2588\u2588\u2588\u2588\u2554\u255d \u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 - \u2588\u2588\u2554\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u255a\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u255a\u2588\u2588\u2554\u255d \u255a\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u255d - \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 - \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d - Hardware Audit LiveCD""" +GLYPHS = { + 'E': ["11111", "10000", "11110", "10000", "10000", "10000", "11111"], + 'A': ["01110", "10001", "10001", "11111", "10001", "10001", "10001"], + 'S': ["01111", "10000", "10000", "01110", "00001", "00001", "11110"], + 'Y': ["10001", "10001", "01010", "00100", "00100", "00100", "00100"], + 'B': ["11110", "10001", "10001", "11110", "10001", "10001", "11110"], + '-': ["00000", "00000", "11111", "00000", "00000", "00000", "00000"], +} -# Find a monospace font that supports box-drawing characters -FONT_CANDIDATES = [ - '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf', - '/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf', - '/usr/share/fonts/truetype/freefont/FreeMono.ttf', - '/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf', +TITLE = "EASY-BEE" +SUBTITLE = "Hardware Audit LiveCD" +CELL = 30 +GLYPH_GAP = 18 +ROW_GAP = 6 + +FG = (0xF6, 0xD0, 0x47) +FG_DIM = (0xD4, 0xA9, 0x1C) +SHADOW = (0x5E, 0x47, 0x05) +SUB = (0x96, 0x7A, 0x17) +BG = (0x05, 0x05, 0x05) + +SUB_FONT_CANDIDATES = [ + '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', + '/usr/share/fonts/truetype/liberation2/LiberationSans-Bold.ttf', + '/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf', + '/usr/share/fonts/truetype/freefont/FreeSansBold.ttf', ] -font_path = None -for p in FONT_CANDIDATES: - if os.path.exists(p): - font_path = p - break -SIZE = 22 -if font_path: - font_logo = ImageFont.truetype(font_path, SIZE) - font_sub = ImageFont.truetype(font_path, SIZE) -else: - font_logo = ImageFont.load_default() - font_sub = font_logo +def load_font(size): + for path in SUB_FONT_CANDIDATES: + if os.path.exists(path): + return ImageFont.truetype(path, size) + return ImageFont.load_default() -img = Image.new('RGB', (W, H), (0, 0, 0)) + +def glyph_width(ch): + return len(GLYPHS[ch][0]) + + +def render_logo_mask(): + width_cells = 0 + for idx, ch in enumerate(TITLE): + width_cells += glyph_width(ch) + if idx != len(TITLE) - 1: + width_cells += 1 + mask_w = width_cells * CELL + (len(TITLE) - 1) * GLYPH_GAP + mask_h = 7 * CELL + 6 * ROW_GAP + mask = Image.new('L', (mask_w, mask_h), 0) + draw = ImageDraw.Draw(mask) + + cx = 0 + for idx, ch in enumerate(TITLE): + glyph = GLYPHS[ch] + for row_idx, row in enumerate(glyph): + for col_idx, cell in enumerate(row): + if cell != '1': + continue + x0 = cx + col_idx * CELL + y0 = row_idx * (CELL + ROW_GAP) + x1 = x0 + CELL - 4 + y1 = y0 + CELL - 4 + draw.rounded_rectangle((x0, y0, x1, y1), radius=4, fill=255) + cx += glyph_width(ch) * CELL + if idx != len(TITLE) - 1: + cx += CELL + GLYPH_GAP + return mask + + +img = Image.new('RGB', (W, H), BG) draw = ImageDraw.Draw(img) -# Measure logo block line by line to avoid font ascender offset -lines = LOGO.split('\n') -logo_lines = lines[:6] -sub_line = lines[6] if len(lines) > 6 else '' +# Soft amber glow under the logo without depending on font rendering. +glow = Image.new('RGBA', (W, H), (0, 0, 0, 0)) +glow_draw = ImageDraw.Draw(glow) +glow_draw.ellipse((360, 250, 1560, 840), fill=(180, 120, 10, 56)) +glow_draw.ellipse((520, 340, 1400, 760), fill=(255, 190, 40, 36)) +glow = glow.filter(ImageFilter.GaussianBlur(60)) +img = Image.alpha_composite(img.convert('RGBA'), glow) -line_h = SIZE + 2 -block_h = len(logo_lines) * line_h + 8 + (SIZE if sub_line else 0) +logo_mask = render_logo_mask() +logo_w, logo_h = logo_mask.size +logo_x = (W - logo_w) // 2 +logo_y = 290 -# Width: measure the widest logo line -max_w = 0 -for line in logo_lines: - bb = draw.textbbox((0, 0), line, font=font_logo) - max_w = max(max_w, bb[2] - bb[0]) +shadow_mask = logo_mask.filter(ImageFilter.GaussianBlur(2)) +img.paste(SHADOW, (logo_x + 16, logo_y + 14), shadow_mask) +img.paste(FG_DIM, (logo_x + 8, logo_y + 7), logo_mask) +img.paste(FG, (logo_x, logo_y), logo_mask) -x = (W - max_w) // 2 -y = (H - block_h) // 2 +font_sub = load_font(30) +sub_bb = draw.textbbox((0, 0), SUBTITLE, font=font_sub) +sub_x = (W - (sub_bb[2] - sub_bb[0])) // 2 +sub_y = logo_y + logo_h + 54 +draw = ImageDraw.Draw(img) +draw.text((sub_x + 2, sub_y + 2), SUBTITLE, font=font_sub, fill=(35, 28, 6)) +draw.text((sub_x, sub_y), SUBTITLE, font=font_sub, fill=SUB) -cy = y -for line in logo_lines: - draw.text((x, cy), line, font=font_logo, fill=(0xf6, 0xc9, 0x0e)) - cy += line_h -cy += 8 -if sub_line: - draw.text((x, cy), sub_line, font=font_sub, fill=(0x80, 0x68, 0x18)) +img = img.convert('RGB') img.save('/usr/share/bee/wallpaper.png', optimize=True) print('wallpaper written: /usr/share/bee/wallpaper.png')