diff --git a/frontend/index.html b/frontend/index.html index 90b37fa..d564dd2 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,6 +3,10 @@ + + + + OMS 管理系统 diff --git a/frontend/public/apple-touch-icon.png b/frontend/public/apple-touch-icon.png new file mode 100644 index 0000000..10f24cf Binary files /dev/null and b/frontend/public/apple-touch-icon.png differ diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico new file mode 100644 index 0000000..ea85384 Binary files /dev/null and b/frontend/public/favicon.ico differ diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg new file mode 100644 index 0000000..e39410b --- /dev/null +++ b/frontend/public/favicon.svg @@ -0,0 +1,13 @@ + + OMS + + + + + + + + + + + diff --git a/frontend/scripts/make-favicon.py b/frontend/scripts/make-favicon.py new file mode 100644 index 0000000..cdb4b11 --- /dev/null +++ b/frontend/scripts/make-favicon.py @@ -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))) \ No newline at end of file