feat(lex): initial release v1.1.0 - offline bilingual dictionary engine
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
ASSETS_DIR = BASE_DIR / "assets"
|
||||
ASSETS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
ICON_PATH = ASSETS_DIR / "lex_icon.ico"
|
||||
|
||||
|
||||
def generate_icon():
|
||||
size = 256
|
||||
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Draw rounded rectangle badge background
|
||||
pad = 16
|
||||
draw.rounded_rectangle(
|
||||
[pad, pad, size - pad, size - pad],
|
||||
radius=48,
|
||||
fill=(24, 119, 242, 255), # Modern royal blue
|
||||
outline=(200, 230, 255, 255),
|
||||
width=4,
|
||||
)
|
||||
|
||||
# Draw inner terminal / book symbol
|
||||
# Book left page
|
||||
draw.polygon(
|
||||
[(64, 80), (124, 70), (124, 180), (64, 170)],
|
||||
fill=(255, 255, 255, 240),
|
||||
)
|
||||
# Book right page
|
||||
draw.polygon(
|
||||
[(132, 70), (192, 80), (192, 170), (132, 180)],
|
||||
fill=(255, 255, 255, 240),
|
||||
)
|
||||
|
||||
# Spine separator line
|
||||
draw.line([(128, 68), (128, 182)], fill=(20, 80, 180, 255), width=3)
|
||||
|
||||
# Text / lines on pages
|
||||
draw.line([(76, 100), (114, 94)], fill=(100, 150, 220, 255), width=3)
|
||||
draw.line([(76, 120), (114, 114)], fill=(100, 150, 220, 255), width=3)
|
||||
draw.line([(76, 140), (114, 134)], fill=(100, 150, 220, 255), width=3)
|
||||
|
||||
draw.line([(142, 94), (180, 100)], fill=(100, 150, 220, 255), width=3)
|
||||
draw.line([(142, 114), (180, 120)], fill=(100, 150, 220, 255), width=3)
|
||||
draw.line([(142, 134), (180, 140)], fill=(100, 150, 220, 255), width=3)
|
||||
|
||||
# Save as multi-size ICO
|
||||
sizes = [(16, 16), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
|
||||
img.save(ICON_PATH, format="ICO", sizes=sizes)
|
||||
print(f"Generated icon at: {ICON_PATH}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_icon()
|
||||
Reference in New Issue
Block a user