其他
需要逆向提取网站设计系统并生成多框架主题时,用…
适用于需要快速复用、对照或监控某网站视觉设计(颜色、字体、间距、阴影、组件样式等),并生成 Tailwind、shadcn/ui、React、Figma、W3C tokens 等产物的场景。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
需要逆向提取网站设计系统并生成多框架主题特定
解决思路
- 无需安装直接运行:`npx designlang https://stripe.com`
- 全局安装:`npm install -g designlang`
- 作为 agent skill 安装:`npx skills add Manavarya09/design-extract`
- 基础提取整站设计:`npx designlang https://stripe.com`
- 启用全部捕获:`npx designlang https://stripe.com --full`
- 自定义输出目录和文件前缀:`npx designlang https://stripe.com --out ./tokens --name stripe`
- 对 SPA 提取前等待加载:`npx designlang https://app.example.com --wait 2000`
- 爬取多个内部页面获取站级 tokens:`npx designlang https://stripe.com --depth 3`
- 提取暗色模式样式:`npx designlang https://vercel.com --dark`
- 在 4 个响应式断点捕获:`npx designlang https://stripe.com --responsive`
- 捕获 hover/focus/active 交互状态:`npx designlang https://stripe.com --interactions`
- 截取组件截图(按钮、卡片、导航、hero):`npx designlang https://stripe.com --screenshots`
- 一次启用全部捕获:`npx designlang https://stripe.com --full`
- 用 cookies 访问受保护页面:`npx designlang https://internal-app.com --cookie "session=abc123" --cookie "user_id=42"`
- 用自定义 headers 访问:`npx designlang https://internal-app.com --header "Authorization:Bearer $TOKEN"`
- 组合 cookies 和 headers:`npx designlang https://app.example.com --cookie "session=$SESSION_COOKIE" --header "X-API-Key:$API_KEY"`
- 对网站设计质量打分(A-F,7 类):`npx designlang score https://vercel.com`
- 并排比较两个网站:`npx designlang diff https://stripe.com https://paddle.com`
- 矩阵比较多个品牌:`npx designlang brands stripe.com vercel.com github.com linear.app`
- 将提取的设计直接应用到项目(自动检测框架):`npx designlang apply https://stripe.com --dir ./my-app`
- 生成可运行的 Next.js starter:`npx designlang clone https://stripe.com`
- 按小时监控网站设计变化:`npx designlang watch https://stripe.com --interval 60`
- 同步本地 tokens 与线上站点:`npx designlang sync https://stripe.com --out ./src/tokens`
- 查看设计变更历史:`npx designlang history https://stripe.com`
- 运行后检查输出文件:`*-design-language.md`(19 节 AI 优化 markdown)、`*-preview.html`(色板、字阶、可访问性评分)、`*-design-tokens.json`(W3C Design Tokens)、`*-tailwind.config.js`、`*-variables.css`、`*-figma-variables.json`、`*-theme.js`、`*-shadcn-theme.css`
- CLI 选项 `-o, --out <dir>`:指定输出目录,默认 `./design-extract-output`。
- CLI 选项 `-n, --name <name>`:指定输出文件前缀,默认从 URL 派生。
- CLI 选项 `-w, --width <px>`:指定视口宽度,默认 1280。
- CLI 选项 `--height <px>`:指定视口高度,默认 800。
- CLI 选项 `--wait <ms>`:页面加载后等待,默认 0,用于 SPA。
- CLI 选项 `--dark`:同时提取暗色模式样式。
- CLI 选项 `--depth <n>`:爬取内部页面数量,默认 0。
- CLI 选项 `--screenshots`:捕获组件截图。
- CLI 选项 `--responsive`:在多个断点捕获。
- CLI 选项 `--interactions`:捕获 hover/focus/active 状态。
- CLI 选项 `--full`:启用全部捕获。
- CLI 选项 `--cookie <val>`:为认证页面传 cookie,格式 `name=value`,可重复。
- CLI 选项 `--header <val>`:传自定义 header,格式 `name:value`,可重复。
- CLI 选项 `--framework <type>`:只生成特定主题(`react`、`shadcn`)。
- CLI 选项 `--no-history`:跳过保存到历史。
- CLI 选项 `--verbose`:输出详细进度。
- Tailwind 项目提取并合并:`npx designlang https://linear.app --out ./design-tokens --name linear`,把 `./design-tokens/linear-tailwind.config.js` 合并到项目;其中包含 colors、fontFamily、fontSize、borderRadius、boxShadow 等。
- 把 AI 优化 markdown 喂给 LLM:`npx designlang https://stripe.com --out ./tokens`,然后 `cat ./tokens/stripe-com-design-language.md | pbcopy`,或在 Claude/Cursor 中引用该文件并要求按 design language 写组件。
- 比较竞争对手:`npx designlang brands stripe.com braintree.com paddle.com adyen.com`,生成 `brands.md` 对比矩阵和 `brands.html` 可视化并含颜色重叠分析。
- 应用到 shadcn/ui 项目:`npx designlang apply https://stripe.com --dir ./my-nextjs-app`;或手动把 `stripe-com-shadcn-theme.css` 内容复制到 `app/globals.css`。
- 生成 W3C Design Tokens:`npx designlang https://github.com --out ./tokens`,使用生成的 `design-tokens.json`(含 `$schema`、`$value`、`$type`)。
- 生成 React theme 对象:`npx designlang https://chakra-ui.com --out ./tokens`,使用 `theme.js` 中的 colors、fonts、space、radii。
- 监控设计系统变化:`npx designlang watch https://vercel.com --interval 30 --out ./design-monitoring`;在 CI 中用 `npx designlang diff https://vercel.com ./design-monitoring/vercel-com-design-tokens.json` 与基线比较。
- 克隆网站设计为 Next.js starter:`npx designlang clone https://stripe.com`,进入 `./cloned-design/`,执行 `npm install` 和 `npm run dev`;其中已有 Tailwind、globals.css、组件 stub。
- 阅读提取结果 markdown,确认覆盖 19 节:Color Palette、Typography、Spacing、Border Radii、Box Shadows、CSS Custom Properties、Breakpoints、Transitions & Animations、Component Patterns、Layout System、Responsive Design、Interaction States、Accessibility、Gradients、Z-Index Map、SVG Icons、Font Files、Image Style Patterns、Quick Start。
- 设计评分覆盖 7 类:Color Discipline、Typography、Spacing System、Shadows、Border Radii、Accessibility、Tokenization,0–100 分并给 A-F 等级。
- 页面空白或样式缺失:加 `--wait 3000`,或用 `--width 1440 --height 900`。
- 认证受保护页面:从浏览器 DevTools → Application → Cookies 获取 session cookie,然后运行 `npx designlang https://app.example.com --cookie "auth_token=$AUTH_TOKEN" --cookie "csrf=$CSRF_TOKEN"`。
- 输出文件太大:用 `--framework react` 或 `--framework shadcn` 只生成特定主题,或用 `--depth 0` 只抓单页。
- 工具 CSS 站点提取颜色太多:用 `--depth 0 --width 1280 --no-history` 限制主页面、桌面视口、不深度爬取。
- Playwright/browser 未找到:运行 `npx playwright install chromium`;或全局安装后运行 `npm install -g designlang` 和 `playwright install chromium`。
- `apply` 不识别框架:显式指定 `--dir ./my-app`;确保目录含 `tailwind.config.js` 或 `tailwind.config.ts`(Tailwind 检测)或 `components.json`(shadcn 检测)。
- 与 AI agent 集成:把 `-design-language.md` 喂给 Claude、GPT-4 或 Cursor,用于重建 UI 组件、生成一致组件、审计组件、自动文档化。
- 提取自己站点的设计语言作为 agent 上下文:`npx designlang https://your-production-site.com --out ./docs/design --name my-app`,并在 `CLAUDE.md` 或 `.cursorrules` 中写“创建 UI 组件时,遵循 ./docs/design/my-app-design-language.md 中的设计语言”。
适用边界 · 注意事项
- 网站禁止自动化抓取、使用条款不允许复制其设计,或你没有权限时不要使用。
- 纯图片、Canvas、WebGL、视频内呈现的视觉样式无法通过 DOM 计算样式提取,不适合此工具。
- 需要分析未渲染组件源码、设计稿源文件或构建期私有变量时,CLI 只能提取线上渲染后的计算结果,不适合。