= {
title: "Wasm design utils",
date: "May 31, 2026",
year: "2025",
- meta: [
- ["Last Updated", "May 31, 2026"],
- ["Dimensions", "1×1"],
- ["Characters", "—"],
- ],
iframe: null,
blocks: [
- { type: "p", segs: [{ t: "text", v: "@wenhaoqi/wasm_design_utils 是一组浏览器端设计小工具:sRGB ↔ OKLCH 色彩转换、图片取色、以及 squircle / capsule 的 SVG 路径生成。npm:" }, { t: "link", v: "@wenhaoqi/wasm_design_utils", href: "https://www.npmjs.com/package/@wenhaoqi/wasm_design_utils" }, { t: "text", v: "。" }] },
+ { type: "p", segs: [{ t: "code", v: "@wenhaoqi/wasm_design_utils" }, { t: "text", v: " 是一组浏览器端设计小工具:sRGB ↔ OKLCH 色彩转换、图片取色、以及 squircle / capsule 的 SVG 路径生成。npm:" }, { t: "link", v: "@wenhaoqi/wasm_design_utils", href: "https://www.npmjs.com/package/@wenhaoqi/wasm_design_utils" }, { t: "text", v: "。" }] },
{ type: "p", segs: [{ t: "text", v: "它最初是在做 " }, { t: "link", v: "Reunimos™", href: "/reunimos" }, { t: "text", v: " 时沉淀下来的,后来打包开源。" }] },
- { type: "h2", text: "#安装" },
- { type: "code", text: "1npm install @wenhaoqi/wasm_design_utils" },
- { type: "p", segs: [{ t: "text", v: "包是 ESM,WASM 默认内联在包里,一般不用自己托管 .wasm 文件。" }] },
- { type: "p", segs: [{ t: "text", v: "所有 API 都是 async,调用时要 await。" }] },
- { type: "h2", text: "#三个模块,按需引入" },
- { type: "list", ordered: false, items: [[{ t: "text", v: "@wenhaoqi/wasm_design_utils/color — RGB ↔ OKLCH" }], [{ t: "text", v: "@wenhaoqi/wasm_design_utils/extract-colors — 从图片提取主色" }], [{ t: "text", v: "@wenhaoqi/wasm_design_utils/squircle — 生成平滑圆角 SVG path" }]] },
- { type: "p", segs: [{ t: "text", v: "也可以从根路径 @wenhaoqi/wasm_design_utils 一次性导入全部 API。" }] },
- { type: "h2", text: "#颜色" },
- { type: "code", text: "1import { rgb2oklch, oklch2rgb_abs, oklch2rgb_rel } from \"@wenhaoqi/wasm_design_utils/color\";2\n3// sRGB 0–255 → OKLCH4const { L, C, h } = await rgb2oklch(128, 100, 231);5\n6// OKLCH → sRGB,直接指定色度7const { R, G, B } = await oklch2rgb_abs(L, C, h);8\n9// 只定明暗和色相,彩度用 0–1 滑杆(更直觉)10const tint = await oklch2rgb_rel(L, h, 0.5);" },
- { type: "p", segs: [{ t: "text", v: "init() 可选。不传的话,第一次调用转换函数时会自动加载 WASM;想在页面启动时预热,可以提前 await init()。" }] },
- { type: "h2", text: "#取色" },
- { type: "code", text: "1import extractColors from \"@wenhaoqi/wasm_design_utils/extract-colors\";2\n3// 从 提取调色板,第一个色块通常是主色4const [dominant, ...rest] = await extractColors(img);5\n6// 常用参数7const palette = await extractColors(img, {8 pixels: 64000, // 抽样分辨率,默认 640009 distance: 0.22, // 聚类距离10 crossOrigin: \"anonymous\", // 跨域图片 URL 时需要11});" },
- { type: "p", segs: [{ t: "text", v: "input 支持:图片 URL 字符串、<img> / Image、ImageData。" }] },
- { type: "h2", text: "#平滑圆角" },
- { type: "p", segs: [{ t: "text", v: "普通 border-radius 在大圆角时转角容易发尖;squircle 用 SVG path 过渡更顺。" }] },
- { type: "code", text: "1import { getPath } from \"@wenhaoqi/wasm_design_utils/squircle\";2\n3const d = await getPath(\"squircle\", 200, 120, 16);4pathEl.setAttribute(\"d\", d);5// viewBox 对应:0 0 200 120" },
- { type: "p", segs: [{ t: "text", v: "shape 也可以是 "capsule"(胶囊形标签、Chip 等)。" }] },
- { type: "h2", text: "#本站怎么用" },
+ { type: "h2", text: "安装", id: "安装" },
+ {
+ type: "code",
+ language: "bash",
+ label: "Bash",
+ html: "1 npm install @wenhaoqi/wasm_design_utils
",
+ text: "1npm install @wenhaoqi/wasm_design_utils",
+ },
+ { type: "p", segs: [{ t: "text", v: "包是 ESM,WASM 默认内联在包里,一般" }, { t: "strong", v: "不用" }, { t: "text", v: "自己托管 " }, { t: "code", v: ".wasm" }, { t: "text", v: " 文件。" }] },
+ { type: "p", segs: [{ t: "text", v: "所有 API 都是 " }, { t: "strong", v: "async" }, { t: "text", v: ",调用时要 " }, { t: "code", v: "await" }, { t: "text", v: "。" }] },
+ { type: "h2", text: "三个模块,按需引入", id: "三个模块按需引入" },
+ { type: "list", ordered: false, items: [[{ t: "code", v: "@wenhaoqi/wasm_design_utils/color" }, { t: "text", v: " — RGB ↔ OKLCH" }], [{ t: "code", v: "@wenhaoqi/wasm_design_utils/extract-colors" }, { t: "text", v: " — 从图片提取主色" }], [{ t: "code", v: "@wenhaoqi/wasm_design_utils/squircle" }, { t: "text", v: " — 生成平滑圆角 SVG path" }]] },
+ { type: "p", segs: [{ t: "text", v: "也可以从根路径 " }, { t: "code", v: "@wenhaoqi/wasm_design_utils" }, { t: "text", v: " 一次性导入全部 API。" }] },
+ { type: "h2", text: "颜色", id: "颜色" },
+ {
+ type: "code",
+ language: "js",
+ label: "JavaScript",
+ html: "1 import { rgb2oklch , oklch2rgb_abs , oklch2rgb_rel } from \"@wenhaoqi/wasm_design_utils/color\" ;
2 \n
3 // sRGB 0–255 → OKLCH
4 const { L , C , h } = await rgb2oklch ( 128 , 100 , 231 ) ;
5 \n
6 // OKLCH → sRGB,直接指定色度
7 const { R , G , B } = await oklch2rgb_abs ( L , C , h ) ;
8 \n
9 // 只定明暗和色相,彩度用 0–1 滑杆(更直觉)
10 const tint = await oklch2rgb_rel ( L , h , 0.5 ) ;
",
+ text: "1import { rgb2oklch, oklch2rgb_abs, oklch2rgb_rel } from \"@wenhaoqi/wasm_design_utils/color\";2\n3// sRGB 0–255 → OKLCH4const { L, C, h } = await rgb2oklch(128, 100, 231);5\n6// OKLCH → sRGB,直接指定色度7const { R, G, B } = await oklch2rgb_abs(L, C, h);8\n9// 只定明暗和色相,彩度用 0–1 滑杆(更直觉)10const tint = await oklch2rgb_rel(L, h, 0.5);",
+ },
+ { type: "p", segs: [{ t: "code", v: "init()" }, { t: "text", v: " 可选。不传的话,第一次调用转换函数时会自动加载 WASM;想在页面启动时预热,可以提前 " }, { t: "code", v: "await init()" }, { t: "text", v: "。" }] },
+ { type: "h2", text: "取色", id: "取色" },
+ {
+ type: "code",
+ language: "js",
+ label: "JavaScript",
+ html: "1 import extractColors from \"@wenhaoqi/wasm_design_utils/extract-colors\" ;
2 \n
3 // 从 <img> 提取调色板,第一个色块通常是主色
4 const [ dominant , ... rest ] = await extractColors ( img ) ;
5 \n
6 // 常用参数
7 const palette = await extractColors ( img , {
8 pixels : 64000 , // 抽样分辨率,默认 64000
9 distance : 0.22 , // 聚类距离
10 crossOrigin : \"anonymous\" , // 跨域图片 URL 时需要
11 } ) ;
",
+ text: "1import extractColors from \"@wenhaoqi/wasm_design_utils/extract-colors\";2\n3// 从 提取调色板,第一个色块通常是主色4const [dominant, ...rest] = await extractColors(img);5\n6// 常用参数7const palette = await extractColors(img, {8 pixels: 64000, // 抽样分辨率,默认 640009 distance: 0.22, // 聚类距离10 crossOrigin: \"anonymous\", // 跨域图片 URL 时需要11});",
+ },
+ { type: "p", segs: [{ t: "code", v: "input" }, { t: "text", v: " 支持:图片 URL 字符串、" }, { t: "code", v: " " }, { t: "text", v: " / " }, { t: "code", v: "Image" }, { t: "text", v: "、" }, { t: "code", v: "ImageData" }, { t: "text", v: "。" }] },
+ { type: "h2", text: "平滑圆角", id: "平滑圆角" },
+ { type: "p", segs: [{ t: "text", v: "普通 " }, { t: "code", v: "border-radius" }, { t: "text", v: " 在大圆角时转角容易发尖;squircle 用 SVG path 过渡更顺。" }] },
+ {
+ type: "code",
+ language: "js",
+ label: "JavaScript",
+ html: "1 import { getPath } from \"@wenhaoqi/wasm_design_utils/squircle\" ;
2 \n
3 const d = await getPath ( \"squircle\" , 200 , 120 , 16 ) ;
4 pathEl . setAttribute ( \"d\" , d ) ;
5 // viewBox 对应:0 0 200 120
",
+ text: "1import { getPath } from \"@wenhaoqi/wasm_design_utils/squircle\";2\n3const d = await getPath(\"squircle\", 200, 120, 16);4pathEl.setAttribute(\"d\", d);5// viewBox 对应:0 0 200 120",
+ },
+ { type: "p", segs: [{ t: "code", v: "shape" }, { t: "text", v: " 也可以是 " }, { t: "code", v: "\"capsule\"" }, { t: "text", v: "(胶囊形标签、Chip 等)。" }] },
+ { type: "h2", text: "本站怎么用", id: "本站怎么用" },
{ type: "p", segs: [{ t: "text", v: "文章页图片放大时,会用取色 + OKLCH 生成跟图片主色接近的蒙层背景:" }] },
- { type: "list", ordered: true, items: [[{ t: "text", v: "extractColors 取主色" }], [{ t: "text", v: "rgb2oklch 转成 OKLCH" }], [{ t: "text", v: "按明暗主题调整亮度,再 oklch2rgb_abs 转回 RGB" }]] },
+ { type: "list", ordered: true, items: [[{ t: "code", v: "extractColors" }, { t: "text", v: " 取主色" }], [{ t: "code", v: "rgb2oklch" }, { t: "text", v: " 转成 OKLCH" }], [{ t: "text", v: "按明暗主题调整亮度,再 " }, { t: "code", v: "oklch2rgb_abs" }, { t: "text", v: " 转回 RGB" }]] },
{ type: "p", segs: [{ t: "text", v: "这样全屏查看图片时,背景不会突兀地跳成纯黑。" }] },
- { type: "h2", text: "#Next.js 注意" },
- { type: "p", segs: [{ t: "text", v: "需要在客户端使用(依赖 Image 和 WebAssembly)。放在 "use client" 组件里,或用动态 import() 加载即可。" }] },
+ { type: "h2", text: "Next.js 注意", id: "nextjs-注意" },
+ { type: "p", segs: [{ t: "text", v: "需要在" }, { t: "strong", v: "客户端" }, { t: "text", v: "使用(依赖 " }, { t: "code", v: "Image" }, { t: "text", v: " 和 WebAssembly)。放在 " }, { t: "code", v: "\"use client\"" }, { t: "text", v: " 组件里,或用动态 " }, { t: "code", v: "import()" }, { t: "text", v: " 加载即可。" }] },
],
},
"/adrive": {
title: "aDrive 阿里云盘",
date: "Jan 07, 2022",
year: "",
- meta: [
- ["Last Updated", "Jan 07, 2022"],
- ["Dimensions", "1×1"],
- ["Characters", "—"],
- ],
iframe: null,
blocks: [
{ type: "p", segs: [{ t: "text", v: "从零搭建阿里云盘设计系统,并参与其长期维护,支撑全端设计语言统一与设计组件复用。参与首页、各版本导航结构与启动器框架,以及影音播放器等业务设计;同时开发或协作开发设计系统文档工具 ADS 客户端与 Figma design token 导出工具。" }] },
@@ -136,22 +143,22 @@ export const WORK_ARTICLES: Record = {
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad2.jpg" },
{ type: "p", segs: [{ t: "text", v: "文件预览、文件预览讨论圈点、视频弹幕圈点(概念)" }] },
{ type: "p", segs: [{ t: "text", v: "在获得外界与集团内部认可之后,我们决定把它做成独立的客户端,并争取到更充裕的研发资源;资源到位之后,也就有条件从零建立一套新的设计系统。" }] },
- { type: "h2", text: "#ADS 架构" },
+ { type: "h2", text: "ADS 架构", id: "ads-架构" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad3.png" },
{ type: "p", segs: [{ t: "text", v: "ADS 有两个驱动核心:一是设计目标,二是业务目标。我们刻意不把二者混为一谈——业务诉求本身并不会自动指向更好的用户体验。持续迭代、不断补全的设计目标,才是拉升体验的主轴;业务目标则负责在收益与体验之间拿捏分寸,避免过度设计。" }] },
- { type: "h2", text: "#ADS 设计原则" },
+ { type: "h2", text: "ADS 设计原则", id: "ads-设计原则" },
{ type: "p", segs: [{ t: "text", v: "好的工作流能够显著提高团队效率;相较某些偏形而上的设计方法,它对组织而言往往更落地、也更容易推广。设计系统本质上就是设计、产品、工程有机融合的一条工作流,Figma 等工具协作可以帮助完成约 60% 的工作,其余部分要靠管理机制与各相关方达成共识来补齐。" }] },
- { type: "h3", text: "#规范简洁" },
+ { type: "h3", text: "规范简洁", id: "规范简洁" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad4.png" },
{ type: "list", ordered: false, items: [[{ t: "text", v: "场景命名" }], [{ t: "text", v: "使用缩写" }], [{ t: "text", v: "层级清晰" }]] },
- { type: "h3", text: "#高度复用" },
+ { type: "h3", text: "高度复用", id: "高度复用" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad5.png" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad6.png" },
{ type: "list", ordered: false, items: [[{ t: "text", v: "组件复用" }], [{ t: "text", v: "跨端一致性" }], [{ t: "text", v: "统一 Token 管理" }]] },
- { type: "h3", text: "#可持续性" },
+ { type: "h3", text: "可持续性", id: "可持续性" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad7.png" },
{ type: "list", ordered: false, items: [[{ t: "text", v: "反馈敏捷" }], [{ t: "text", v: "受控逃逸 / Escape hatch(允许在特殊情况下跨出设计系统的既定限制,避免机制僵化;并非鼓励随意破窗,而是为真实业务留出可控出口)" }]] },
- { type: "h2", text: "#ADS 周边工具链" },
+ { type: "h2", text: "ADS 周边工具链", id: "ads-周边工具链" },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/adrive/ad8.png" },
{ type: "p", segs: [{ t: "text", v: "ADS 客户端基于 Gatsby 与 Electron 开发,用于承载设计系统文档、组件演示与设计资源整合。对仅有 Figma 查看权限的同学,它还能把多条设计稿链接拼成一张「设计地图」。在团队语境里,大家默认:凡与云盘设计相关的内容,都会在 ADS 客户端里找到对应落点。" }] },
{ type: "p", segs: [{ t: "text", v: "Fridge 也被纳入阿里云盘项目,用于把更完整的色板与 icon 实时同步给使用者。" }] },
@@ -183,65 +190,72 @@ export const WORK_ARTICLES: Record = {
title: "Shore Icon",
date: "Mar 01, 2022",
year: "2022",
- meta: [
- ["Last Updated", "Mar 01, 2022"],
- ["Dimensions", "1×1"],
- ["Characters", "—"],
- ],
iframe: null,
blocks: [
{ type: "p", segs: [{ t: "text", v: "在 Shore 的工作时间不长,但我做了一套风格现代、维护成本可控的图标系统(Icon System)。过程中主要参考了刚完成重构的 " }, { t: "link", v: "Spotify Icon System", href: "https://spotify.design/article/refreshing-our-icon-system-the-why-and-how-behind-the-changes" }, { t: "text", v: "、微软的 " }, { t: "link", v: "Microsoft Fluent System Icons", href: "https://www.figma.com/community/file/836835755999342788/Microsoft-Fluent-System-Icons" }, { t: "text", v: ",以及业内的 " }, { t: "link", v: "SF Symbols", href: "https://developer.apple.com/design/resources/#sf-symbols" }, { t: "text", v: "。这套系统在风格管理、版本管理、跨端表现和自动化交付上都更顺手,我也希望把其中的经验留给正在从零搭建或准备重构图标系统的团队与设计师。" }] },
{ type: "p", segs: [{ t: "text", v: "要做一套好用的图标系统,风格统一、识别清晰、交付与管理简单——听起来是共识,真正落地时每一环都可能变成痛点。" }] },
- { type: "h2", text: "#风格统一" },
+ { type: "h2", text: "风格统一", id: "风格统一" },
{ type: "p", segs: [{ t: "text", v: "图标能不能称为「系统」,第一条往往是够不够统一。我们以前的做法,是在统一尺寸的画布上,用一套网格约束、几档规范的圆角和统一的描边粗细去框图形。这样顶多统一了表层样式;若网格卡得太死,执行时很容易出现「多一格嫌长、少一格嫌短」的别扭,反而违背视觉直觉。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon01.png" },
{ type: "p", segs: [{ t: "text", v: "Material 与 Ant Design 的图标网格" }] },
- { type: "h2", text: "#识别清晰" },
+ { type: "h2", text: "识别清晰", id: "识别清晰" },
{ type: "p", segs: [{ t: "text", v: "图标传达内容,不只靠外形,还与最小可用尺寸、正负形是否一致有关;这些细节会直接影响识别,也容易制造视觉错觉。" }] },
- { type: "h3", text: "#交付与管理" },
+ { type: "h3", text: "交付与管理", id: "交付与管理" },
{ type: "p", segs: [{ t: "text", v: "把多人绘制的图标收成一套资源,本身就很费神。好在 Figma 能让更多人在同一份设计稿里协作,历史版本也算能管。但设计稿的版本并不等于研发最终接手的版本,两者很容易脱节。每次还要按端单独导出格式,若没有专人维护,输出就会越来越乱,最后线上各端各版本、各画各的图标。" }] },
{ type: "p", segs: [{ t: "text", v: "阿里巴巴的 " }, { t: "link", v: "iconfont", href: "https://www.iconfont.cn/" }, { t: "text", v: " 在上一代工具里很好地缓解过这些问题,但以今天的协作与工程节奏来看,已经明显不够用了。" }] },
- { type: "h2", text: "#SF Symbols" },
+ { type: "h2", text: "SF Symbols", id: "sf-symbols" },
{ type: "p", segs: [{ t: "link", v: "SF Symbols →", href: "https://developer.apple.com/design/resources/#sf-symbols" }] },
{ type: "p", segs: [{ t: "text", v: "门槛最低:多数设计师的 Mac 上都装得到 SF Symbols。细读之后会发现,无论从哪个维度看,这套图标都相当出色。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon02.png" },
{ type: "p", segs: [{ t: "text", v: "SF 的图标与 SF Pro 是一起为混排设计的,因此字形的中线、基线也会进图标参考;字体没有「裁剪内容」一类的包袱,边缘留多少不必纠结。每个字重都有对应图标,第一眼就很震撼。3.0 起又补了大量彩色图标,同样基于彩色字体。" }] },
{ type: "p", segs: [{ t: "text", v: "我把 SF 放进 Figma 看路径时发现:每个字重下还有 5 档相对宽度,而且宽度变化是线性的,并不是随便挑几个档位——多半是为了让描边粗细在观感上更均匀。另一个细节是转折与交叉处的「收口」,这是字形里常用的手法,让弯折处看起来和直线段一样稳,小尺寸也更清楚;在成千上万枚图标里坚持这样做,非常难得。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon03.png" },
- { type: "h2", text: "#Microsoft Fluent System Icons" },
+ { type: "h2", text: "Microsoft Fluent System Icons", id: "microsoft-fluent-system-icons" },
{ type: "p", segs: [{ t: "link", v: "Microsoft Fluent System Icons →", href: "https://www.figma.com/community/file/836835755999342788/Microsoft-Fluent-System-Icons" }] },
{ type: "p", segs: [{ t: "text", v: "微软更慷慨一些,把整套图标系统设计稿放在 Figma 社区里,规范也写得清楚,很适合当教材。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon04.png" },
{ type: "p", segs: [{ t: "text", v: "Fluent 讲了网格、不同类型外形的画法、怎么测视觉权重、填充图标怎么处理,以及角标不要挡关键信息——而不只是「铺一层底色」那种粗暴做法,等等。" }] },
- { type: "h2", text: "#Spotify Icon System" },
+ { type: "h2", text: "Spotify Icon System", id: "spotify-icon-system" },
{ type: "p", segs: [{ t: "link", v: "Refreshing our Icon System: the why and how behind the changes →", href: "https://spotify.design/article/refreshing-our-icon-system-the-why-and-how-behind-the-changes" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon05.png" },
{ type: "p", segs: [{ t: "text", v: "在我看来,Spotify 很擅长用较低成本换较大收益,跨端设计系统就是例子;这次图标系统更新也延续了同一套思路。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon06.png" },
{ type: "p", segs: [{ t: "text", v: "新系统用两种线宽覆盖两类尺寸区间,并对不同线宽做不同细化——相比 SF 为每个字重各做一整套图标,更贴近「资源没有苹果那么宽裕」的普通团队。" }] },
{ type: "p", segs: [{ t: "text", v: "有了前面的输入,我想做一套自己的图标系统:视觉统一、识别清楚、手感平衡,还要有一条顺手的交付链路。把整套库做成能和文字自然混排的字体,对我来说不现实,维护和绘制成本都太高,最后还是落在更主流的 SVG 上。不同的是我选了 " }, { t: "link", v: "SVG Symbol", href: "https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/symbol" }, { t: "text", v: " 这种单文件、多图形的组织方式,导出则依赖我自研的 Figma 插件 " }, { t: "link", v: "VectorS", href: "/stories/figma_and_me#vectors" }, { t: "text", v: "。" }] },
- { type: "h2", text: "#多重线宽" },
+ { type: "h2", text: "多重线宽", id: "多重线宽" },
{ type: "p", segs: [{ t: "text", v: "我借鉴了 SF 的多档线宽思路,在 24×24 的格子里找出视觉平衡的 5 档宽度,并为每一档写了使用说明。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon07.png" },
{ type: "p", segs: [{ t: "text", v: "为了批量整理图标在 Frame 里的适配规则、少手填线宽,我在 VectorS 里加了一串小工具做样式填充,线宽这一层就这样收住了。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon08.png" },
- { type: "h2", text: "#非严格的网格" },
+ { type: "h2", text: "非严格的网格", id: "非严格的网格" },
{ type: "p", segs: [{ t: "text", v: "很多第三方图标不如官方图标「舒服」,很大一部分原因是对网格的理解:网格应是参照,而不是枷锁;在网格给定的范围里画出舒服的形,比处处贴齐更重要。各家的官方图标也不是死板对齐,而是灵活运用对齐与对比。" }] },
{ type: "p", segs: [{ t: "text", v: "我画了一套偏「非严格」的辅助网格,定形之后再配合模糊看视觉权重。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon09.png" },
- { type: "h2", text: "#非零与偶奇填充" },
+ { type: "h2", text: "非零与偶奇填充", id: "非零与偶奇填充" },
{ type: "p", segs: [{ t: "text", v: "非零规则(non-zero)与偶奇规则(even-odd)对应 SVG 的 " }, { t: "link", v: "fill-rule", href: "https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/fill-rule" }, { t: "text", v: ",描述的是路径布尔运算怎么算。简单说,要么按路径的绕向自动运算,要么靠标记规则;前者兼容性更好(字体、Android 矢量等),后者在 Web 与 iOS 上往往更可控。" }] },
{ type: "p", segs: [{ t: "text", v: "Figma 默认更接近 even-odd。用过 Figma 导出到 iconfont 的人多半知道 " }, { t: "link", v: "Fill Rule Editor", href: "https://www.figma.com/community/plugin/771155994770327940/Fill-Rule-Editor" }, { t: "text", v: "——它通过调整路径方向,让结果符合 non-zero 规则。作者曾是 Figma 的前 CTO,不知是否因此,社区里几乎找不到第二个做同类事的插件。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon10.png" },
{ type: "p", segs: [{ t: "text", v: "为跨端考虑,Shore Icon 的填充规则我选了兼容性更好的 non-zero。" }] },
- { type: "h2", text: "#统一输出格式" },
+ { type: "h2", text: "统一输出格式", id: "统一输出格式" },
{ type: "p", segs: [{ t: "text", v: "格式统一同样是跨端前提。我用插件导出两种格式,给研发同事评估怎么消费。" }] },
{ type: "p", segs: [{ t: "text", v: "SVG Symbol 格式预览" }] },
- { type: "code", text: "12 3 4 5 6 7 8 13 14 15 16 17 18 " },
+ {
+ type: "code",
+ language: "xml",
+ label: "Xml",
+ html: "1 < svg style = \" display: none; \" xmlns = \" http://www.w3.org/2000/svg \" xmlns: xlink = \" http://www.w3.org/1999/xlink \" >
2 <!-- 3 icons / 2022/3/18上午1:31:10 / VectorS 1.0.0 -->
3 < symbol id = \" Figma \" viewbox = \" 0 0 24 24 \" >
4 < g transform = \" translate(5.1 2.1) \" >
5 < path fill-rule = \" evenodd \" clip-rule = \" evenodd \" d = \" M 3.9 0 L 9.9 0 C 12.053 0 13.8 1.747 13.8 3.9 C 13.8 5.106 13.252 6.185 12.391 6.9 C 13.252 7.616 13.8 8.694 13.8 9.9 C 13.8 12.053 12.053 13.8 9.9 13.8 C 9.127 13.8 8.406 13.575 7.8 13.186 L 7.8 15.9 C 7.8 18.053 6.053 19.8 3.9 19.8 C 1.747 19.8 0 18.053 0 15.9 C 0 14.694 0.548 13.616 1.409 12.9 C 0.548 12.184 0 11.106 0 9.9 C 0 8.694 0.548 7.616 1.409 6.9 C 0.548 6.185 0 5.106 0 3.9 C 0 1.747 1.747 0 3.9 0 Z M 1.8 3.9 C 1.8 2.741 2.741 1.8 3.9 1.8 L 6 1.8 L 6 6 L 3.9 6 C 2.741 6 1.8 5.059 1.8 3.9 Z M 6 9.902 C 6 9.901 6 9.901 6 9.9 C 6 9.899 6 9.899 6 9.898 L 6 7.8 L 3.9 7.8 C 2.741 7.8 1.8 8.741 1.8 9.9 C 1.8 11.059 2.741 12 3.9 12 L 6 12 L 6 9.902 Z M 7.8 9.9 C 7.8 11.059 8.741 12 9.9 12 C 11.059 12 12 11.059 12 9.9 C 12 8.741 11.059 7.8 9.9 7.8 C 8.741 7.8 7.8 8.741 7.8 9.9 Z M 9.9 6 C 11.059 6 12 5.059 12 3.9 C 12 2.741 11.059 1.8 9.9 1.8 L 7.8 1.8 L 7.8 6 L 9.9 6 Z M 1.8 15.9 C 1.8 14.741 2.741 13.8 3.9 13.8 L 6 13.8 L 6 15.9 C 6 17.059 5.059 18 3.9 18 C 2.741 18 1.8 17.059 1.8 15.9 Z \" fill = \" rgb(0,0,0) \" />
6 </ g >
7 </ symbol >
8 < symbol id = \" Twitter \" viewbox = \" 0 0 24 24 \" >
9 < g transform = \" translate(2.5 4) \" >
10 < path d = \" M 17.048 3.984 C 17.055 4.16 17.055 4.328 17.055 4.504 C 17.063 9.84 13.143 16 5.973 16 C 3.859 16 1.783 15.368 0 14.184 C 0.309 14.224 0.617 14.24 0.926 14.24 C 2.678 14.24 4.383 13.632 5.765 12.504 C 4.098 12.472 2.632 11.344 2.122 9.696 C 2.709 9.816 3.311 9.792 3.882 9.624 C 2.068 9.256 0.764 7.6 0.756 5.672 C 0.756 5.656 0.756 5.64 0.756 5.624 C 1.297 5.936 1.906 6.112 2.524 6.128 C 0.818 4.944 0.286 2.584 1.32 0.736 C 3.303 3.264 6.22 4.792 9.353 4.96 C 9.037 3.56 9.469 2.088 10.48 1.096 C 12.047 -0.432 14.516 -0.352 15.998 1.272 C 16.87 1.096 17.711 0.76 18.475 0.288 C 18.182 1.224 17.572 2.016 16.762 2.52 C 17.534 2.424 18.29 2.208 19 1.888 C 18.475 2.704 17.812 3.408 17.048 3.984 Z \" fill = \" rgb(0,0,0) \" />
11 </ g >
12 </ symbol >
13 < symbol id = \" Instagram \" viewbox = \" 0 0 24 24 \" >
14 < g transform = \" translate(2 2) \" >
15 < path fill-rule = \" evenodd \" clip-rule = \" evenodd \" d = \" M 9.996 4.865 C 7.163 4.865 4.861 7.163 4.861 10 C 4.861 12.837 7.159 15.135 9.996 15.135 C 12.833 15.135 15.131 12.837 15.131 10 C 15.131 7.163 12.833 4.865 9.996 4.865 Z M 9.996 13.329 C 8.155 13.329 6.663 11.837 6.663 9.996 C 6.663 8.155 8.155 6.663 9.996 6.663 C 11.837 6.663 13.329 8.155 13.329 9.996 C 13.329 11.837 11.837 13.329 9.996 13.329 Z M 16.532 4.659 C 16.532 5.321 15.995 5.857 15.333 5.857 C 14.671 5.857 14.135 5.321 14.135 4.659 C 14.135 3.997 14.671 3.46 15.333 3.46 C 15.995 3.46 16.532 3.997 16.532 4.659 Z M 9.996 0 C 7.282 0 6.94 0.012 5.873 0.06 C 4.81 0.107 4.083 0.278 3.448 0.524 C 2.79 0.778 2.234 1.123 1.679 1.679 C 1.123 2.234 0.782 2.794 0.524 3.448 C 0.278 4.083 0.107 4.81 0.06 5.877 C 0.012 6.94 0 7.282 0 9.996 C 0 12.71 0.012 13.052 0.06 14.119 C 0.107 15.183 0.278 15.909 0.524 16.548 C 0.778 17.206 1.123 17.762 1.679 18.317 C 2.234 18.873 2.794 19.214 3.448 19.472 C 4.083 19.718 4.81 19.889 5.877 19.936 C 6.944 19.984 7.282 19.996 10 19.996 C 12.718 19.996 13.056 19.984 14.123 19.936 C 15.187 19.889 15.913 19.718 16.552 19.472 C 17.21 19.218 17.766 18.873 18.321 18.317 C 18.877 17.762 19.218 17.202 19.476 16.548 C 19.722 15.913 19.893 15.186 19.94 14.119 C 19.988 13.052 20 12.714 20 9.996 C 20 7.278 19.988 6.94 19.94 5.873 C 19.893 4.81 19.722 4.083 19.476 3.444 C 19.222 2.786 18.877 2.23 18.321 1.675 C 17.766 1.119 17.206 0.778 16.552 0.52 C 15.917 0.274 15.19 0.103 14.123 0.056 C 13.052 0.012 12.71 0 9.996 0 Z M 9.996 1.802 C 12.667 1.802 12.98 1.813 14.036 1.861 C 15.012 1.905 15.54 2.067 15.893 2.206 C 16.361 2.389 16.694 2.603 17.044 2.952 C 17.393 3.302 17.611 3.635 17.79 4.103 C 17.925 4.456 18.091 4.984 18.135 5.96 C 18.183 7.016 18.194 7.329 18.194 10 C 18.194 12.671 18.183 12.984 18.135 14.04 C 18.091 15.016 17.929 15.544 17.79 15.897 C 17.607 16.365 17.393 16.698 17.044 17.048 C 16.694 17.397 16.361 17.615 15.893 17.794 C 15.54 17.929 15.012 18.095 14.036 18.139 C 12.98 18.186 12.667 18.198 9.996 18.198 C 7.325 18.198 7.012 18.186 5.956 18.139 C 4.98 18.095 4.452 17.933 4.099 17.794 C 3.631 17.611 3.298 17.397 2.948 17.048 C 2.599 16.698 2.381 16.365 2.202 15.897 C 2.067 15.544 1.901 15.016 1.857 14.04 C 1.81 12.984 1.798 12.671 1.798 10 C 1.798 7.329 1.81 7.016 1.857 5.96 C 1.901 4.984 2.063 4.456 2.202 4.103 C 2.385 3.635 2.599 3.302 2.948 2.952 C 3.298 2.603 3.631 2.385 4.099 2.206 C 4.452 2.071 4.98 1.905 5.956 1.861 C 7.012 1.81 7.329 1.802 9.996 1.802 Z \" fill = \" rgb(0,0,0) \" />
16 </ g >
17 </ symbol >
18 </ svg >
",
+ text: "12 3 4 5 6 7 8 13 14 15 16 17 18 ",
+ },
{ type: "p", segs: [{ t: "text", v: "JSON 格式数据结构预览" }] },
- { type: "code", text: "1{2 \"name\": \"FigmaIcon\",3 \"description\": \"\",4 \"width\": 24,5 \"height\": 24,6 \"id\": [7 \"3627:1307\",8 \"046c56ddfafa72e2cbb4b521de681feed7b9db0b\"9 ],10 \"paths\": [11 {12 \"color\": {13 \"r\": 0,14 \"g\": 0,15 \"b\": 016 },17 \"evenodd\": false,18 \"opacity\": 1,19 \"path\": [20 \"M 3.9 0 L 9.9 0 C 12.053 0 13.8 1.747 13.8 3.9 C 13.8 5.106 13.252 6.185 12.391 6.9 C 13.252 7.616 13.8 8.694 13.8 9.9 C 13.8 12.053 12.053 13.8 9.9 13.8 C 9.127 13.8 8.406 13.575 7.8 13.186 L 7.8 15.9 C 7.8 18.053 6.053 19.8 3.9 19.8 C 1.747 19.8 0 18.053 0 15.9 C 0 14.694 0.548 13.616 1.409 12.9 C 0.548 12.184 0 11.106 0 9.9 C 0 8.694 0.548 7.616 1.409 6.9 C 0.548 6.185 0 5.106 0 3.9 C 0 1.747 1.747 0 3.9 0 Z M 1.8 3.9 C 1.8 2.741 2.741 1.8 3.9 1.8 L 6 1.8 L 6 6 L 3.9 6 C 2.741 6 1.8 5.059 1.8 3.9 Z M 6 9.902 C 6 9.901 6 9.901 6 9.9 C 6 9.899 6 9.899 6 9.898 L 6 7.8 L 3.9 7.8 C 2.741 7.8 1.8 8.741 1.8 9.9 C 1.8 11.059 2.741 12 3.9 12 L 6 12 L 6 9.902 Z M 7.8 9.9 C 7.8 11.059 8.741 12 9.9 12 C 11.059 12 12 11.059 12 9.9 C 12 8.741 11.059 7.8 9.9 7.8 C 8.741 7.8 7.8 8.741 7.8 9.9 Z M 9.9 6 C 11.059 6 12 5.059 12 3.9 C 12 2.741 11.059 1.8 9.9 1.8 L 7.8 1.8 L 7.8 6 L 9.9 6 Z M 1.8 15.9 C 1.8 14.741 2.741 13.8 3.9 13.8 L 6 13.8 L 6 15.9 C 6 17.059 5.059 18 3.9 18 C 2.741 18 1.8 17.059 1.8 15.9 Z\"21 ],22 \"x\": 5.1,23 \"y\": 2.124 }25 ]26}" },
+ {
+ type: "code",
+ language: "json",
+ label: "JSON",
+ html: "1 {
2 \"name\" : \"FigmaIcon\" ,
3 \"description\" : \"\" ,
4 \"width\" : 24 ,
5 \"height\" : 24 ,
6 \"id\" : [
7 \"3627:1307\" ,
8 \"046c56ddfafa72e2cbb4b521de681feed7b9db0b\"
9 ] ,
10 \"paths\" : [
11 {
12 \"color\" : {
13 \"r\" : 0 ,
14 \"g\" : 0 ,
15 \"b\" : 0
16 } ,
17 \"evenodd\" : false ,
18 \"opacity\" : 1 ,
19 \"path\" : [
20 \"M 3.9 0 L 9.9 0 C 12.053 0 13.8 1.747 13.8 3.9 C 13.8 5.106 13.252 6.185 12.391 6.9 C 13.252 7.616 13.8 8.694 13.8 9.9 C 13.8 12.053 12.053 13.8 9.9 13.8 C 9.127 13.8 8.406 13.575 7.8 13.186 L 7.8 15.9 C 7.8 18.053 6.053 19.8 3.9 19.8 C 1.747 19.8 0 18.053 0 15.9 C 0 14.694 0.548 13.616 1.409 12.9 C 0.548 12.184 0 11.106 0 9.9 C 0 8.694 0.548 7.616 1.409 6.9 C 0.548 6.185 0 5.106 0 3.9 C 0 1.747 1.747 0 3.9 0 Z M 1.8 3.9 C 1.8 2.741 2.741 1.8 3.9 1.8 L 6 1.8 L 6 6 L 3.9 6 C 2.741 6 1.8 5.059 1.8 3.9 Z M 6 9.902 C 6 9.901 6 9.901 6 9.9 C 6 9.899 6 9.899 6 9.898 L 6 7.8 L 3.9 7.8 C 2.741 7.8 1.8 8.741 1.8 9.9 C 1.8 11.059 2.741 12 3.9 12 L 6 12 L 6 9.902 Z M 7.8 9.9 C 7.8 11.059 8.741 12 9.9 12 C 11.059 12 12 11.059 12 9.9 C 12 8.741 11.059 7.8 9.9 7.8 C 8.741 7.8 7.8 8.741 7.8 9.9 Z M 9.9 6 C 11.059 6 12 5.059 12 3.9 C 12 2.741 11.059 1.8 9.9 1.8 L 7.8 1.8 L 7.8 6 L 9.9 6 Z M 1.8 15.9 C 1.8 14.741 2.741 13.8 3.9 13.8 L 6 13.8 L 6 15.9 C 6 17.059 5.059 18 3.9 18 C 2.741 18 1.8 17.059 1.8 15.9 Z\"
21 ] ,
22 \"x\" : 5.1 ,
23 \"y\" : 2.1
24 }
25 ]
26 }
",
+ text: "1{2 \"name\": \"FigmaIcon\",3 \"description\": \"\",4 \"width\": 24,5 \"height\": 24,6 \"id\": [7 \"3627:1307\",8 \"046c56ddfafa72e2cbb4b521de681feed7b9db0b\"9 ],10 \"paths\": [11 {12 \"color\": {13 \"r\": 0,14 \"g\": 0,15 \"b\": 016 },17 \"evenodd\": false,18 \"opacity\": 1,19 \"path\": [20 \"M 3.9 0 L 9.9 0 C 12.053 0 13.8 1.747 13.8 3.9 C 13.8 5.106 13.252 6.185 12.391 6.9 C 13.252 7.616 13.8 8.694 13.8 9.9 C 13.8 12.053 12.053 13.8 9.9 13.8 C 9.127 13.8 8.406 13.575 7.8 13.186 L 7.8 15.9 C 7.8 18.053 6.053 19.8 3.9 19.8 C 1.747 19.8 0 18.053 0 15.9 C 0 14.694 0.548 13.616 1.409 12.9 C 0.548 12.184 0 11.106 0 9.9 C 0 8.694 0.548 7.616 1.409 6.9 C 0.548 6.185 0 5.106 0 3.9 C 0 1.747 1.747 0 3.9 0 Z M 1.8 3.9 C 1.8 2.741 2.741 1.8 3.9 1.8 L 6 1.8 L 6 6 L 3.9 6 C 2.741 6 1.8 5.059 1.8 3.9 Z M 6 9.902 C 6 9.901 6 9.901 6 9.9 C 6 9.899 6 9.899 6 9.898 L 6 7.8 L 3.9 7.8 C 2.741 7.8 1.8 8.741 1.8 9.9 C 1.8 11.059 2.741 12 3.9 12 L 6 12 L 6 9.902 Z M 7.8 9.9 C 7.8 11.059 8.741 12 9.9 12 C 11.059 12 12 11.059 12 9.9 C 12 8.741 11.059 7.8 9.9 7.8 C 8.741 7.8 7.8 8.741 7.8 9.9 Z M 9.9 6 C 11.059 6 12 5.059 12 3.9 C 12 2.741 11.059 1.8 9.9 1.8 L 7.8 1.8 L 7.8 6 L 9.9 6 Z M 1.8 15.9 C 1.8 14.741 2.741 13.8 3.9 13.8 L 6 13.8 L 6 15.9 C 6 17.059 5.059 18 3.9 18 C 2.741 18 1.8 17.059 1.8 15.9 Z\"21 ],22 \"x\": 5.1,23 \"y\": 2.124 }25 ]26}",
+ },
{ type: "p", segs: [{ t: "text", v: "调研下来,JSON 虽易读,若要再编译成各端格式,往往仍要各端各用各的技术栈。前端的方案是直接消费 SVG Symbol,打包进 React 组件、用 Props 调图标;构建阶段再用 Node 工具把 Symbol 拆成适合移动端的单文件 SVG。整条链路可以交给 GitHub Actions 一类流程自动化,统一格式与交付也就闭环了。" }] },
- { type: "h2", text: "#版本管理" },
+ { type: "h2", text: "版本管理", id: "版本管理" },
{ type: "p", segs: [{ t: "text", v: "最后一个问题乍看棘手,其实前面几步已经埋好答案:用 GitHub 管代码即可。只是 GitHub 面向工程思维,我能逐行读 SVG 的 Diff,不是所有设计师都习惯这一套。" }] },
{ type: "img", src: "https://mysite2026-blog-cyn6.vercel.app/blog/shore/icon11.png" },
{ type: "p", segs: [{ t: "text", v: "接下来想把 VectorS 接到 GitHub:身份验证通过后,插件读取仓库里约定的 SVG Symbol,在界面里渲染出来,再通过 API 拉 Diff 做图形化对比——有点像 Abstract 在做的事。" }] },
@@ -252,11 +266,6 @@ export const WORK_ARTICLES: Record = {
title: "Teambition",
date: "May 31, 2026",
year: "2018-2020",
- meta: [
- ["Last Updated", "May 31, 2026"],
- ["Dimensions", "1×1"],
- ["Characters", "—"],
- ],
iframe: null,
blocks: [
{ type: "p", segs: [{ t: "text", v: "Work in progress — this page is not finished yet." }] },