feat(frontend): 新增 OMS 站点图标 favicon(矢量 + 多尺寸 ICO)

- 设计:深蓝圆角底 + 等轴测立方体,语义对应包裹 / 仓储 / 订单履约
- public/favicon.svg(矢量源,现代浏览器优先用)、public/favicon.ico(16/24/32/48/64/128/256 七档)、
  public/apple-touch-icon.png(180)
- index.html 增加 icon / apple-touch-icon 链接与 theme-color
- scripts/make-favicon.py 保留生成脚本,改配色或形状后可一键重出

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-02 01:25:14 +08:00
parent 7254125088
commit 49fec97526
5 changed files with 83 additions and 0 deletions

View File

@ -3,6 +3,10 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#0a1a33" />
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>OMS 管理系统</title>
</head>
<body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
frontend/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" role="img" aria-label="OMS">
<title>OMS</title>
<defs>
<linearGradient id="oms-bg" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#103A96" />
<stop offset="1" stop-color="#06142E" />
</linearGradient>
</defs>
<rect width="256" height="256" rx="58" fill="url(#oms-bg)" />
<polygon points="34,82 128,134 128,240 34,186" fill="#DEEAFF" />
<polygon points="224,82 128,134 128,240 224,186" fill="#B0CBFA" />
<polygon points="128,28 224,82 128,134 34,82" fill="#FFFFFF" />
</svg>

After

Width:  |  Height:  |  Size: 581 B

View File

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
"""OMS 站点图标生成器(Pillow):深蓝圆角底 + 等轴测立方体(包裹 / 仓储 / 订单语义)。
渲染时 16 倍超采样再缩采样,导出多尺寸 ICO(Windows / 浏览器通用)+ apple-touch-icon。
改配色或形状后重跑本脚本即可;矢量同源版本见 favicon.svg。"""
import os
from PIL import Image, ImageDraw
OUT_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'public'))
S = 256
BG_TOP = (16, 58, 150) # #103A96
BG_BOTTOM = (6, 20, 46) # #06142E
FACE_TOP = (255, 255, 255)
FACE_LEFT = (222, 234, 255) # #DEEAFF
FACE_RIGHT = (176, 203, 250) # #B0CBFA
def lerp(a, b, t):
return tuple(int(round(a[i] + (b[i] - a[i]) * t)) for i in range(3))
def render(size, ss=16):
w = size * ss
tile = Image.new('RGB', (w, w))
d = ImageDraw.Draw(tile)
for y in range(w):
d.line([(0, y), (w, y)], fill=lerp(BG_TOP, BG_BOTTOM, y / (w - 1)))
# 圆角遮罩(Pillow 7 无 rounded_rectangle:矩形 + 四角圆)
mask = Image.new('L', (w, w), 0)
md = ImageDraw.Draw(mask)
r = int(w * 0.225)
md.rectangle([r, 0, w - r - 1, w - 1], fill=255)
md.rectangle([0, r, w - 1, w - r - 1], fill=255)
md.ellipse([0, 0, 2 * r, 2 * r], fill=255)
md.ellipse([w - 1 - 2 * r, 0, w - 1, 2 * r], fill=255)
md.ellipse([0, w - 1 - 2 * r, 2 * r, w - 1], fill=255)
md.ellipse([w - 1 - 2 * r, w - 1 - 2 * r, w - 1, w - 1], fill=255)
img = tile.convert('RGBA')
img.putalpha(mask)
d2 = ImageDraw.Draw(img)
def p(x, y):
return (x / 256.0 * (w - 1), y / 256.0 * (w - 1))
top = p(128, 28)
up_right = p(224, 82)
low_right = p(224, 186)
bottom = p(128, 240)
low_left = p(34, 186)
up_left = p(34, 82)
center = p(128, 134)
d2.polygon([up_left, center, bottom, low_left], fill=FACE_LEFT)
d2.polygon([up_right, center, bottom, low_right], fill=FACE_RIGHT)
d2.polygon([top, up_right, center, up_left], fill=FACE_TOP)
return img.resize((size, size), Image.LANCZOS)
master = render(S)
master.save(os.path.join(OUT_DIR, 'favicon.ico'), format='ICO',
sizes=[(s, s) for s in (16, 24, 32, 48, 64, 128, 256)])
master.resize((180, 180), Image.LANCZOS).save(os.path.join(OUT_DIR, 'apple-touch-icon.png'), format='PNG')
print('ok:', sorted(os.listdir(OUT_DIR)))