Token导航 LogoToken导航TokenDH.com
效率操作浏览器clawhub未标认证来源可访问clear审计提醒

design-to-html设计 TO HTML

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

1,035

周安装

44

GitHub Stars

公开资料未说明

下载量

363
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:design-to-html(设计 TO HTML)
来源仓库:https://github.com/nodermachine/design-to-html
安装命令:
openclaw skills install design-to-html
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install design-to-html

简介

通过分析布局、颜色、字体,然后通过自动视觉比较迭代优化代码,将设计图像转换为像素完美的 HTML/CSS。

SKILL.md

name
design-to-html
description
Convert visual design mockups/images to pixel-perfect HTML/CSS code through iterative refinement. Use when user wants to: (1) Convert a design image/screenshot to HTML code, (2) Generate web pages from visual mockups, (3) Create HTML that matches a design pixel-by-pixel, (4) Iteratively improve HTML to match visual design. Triggers on phrases like "convert design to HTML", "from image to code", "pixel-perfect HTML", "design mockup to code".
metadata
openclaw
requires
env
[]
primaryEnv
null

Design to HTML

Convert visual design images to pixel-perfect HTML/CSS through iterative refinement with automated visual comparison.

Workflow

Input: Design image (PNG/JPG)
Output: HTML/CSS code + comparison report

Process:
1. Analyze design → Generate initial HTML
2. Render HTML → Compare with original
3. Generate diff report → Optimize HTML
4. Repeat 5 times or until 95% match
5. Output final code + report

Step 1: Initialize

Command: /design-to-html <image-path> [--threshold 95] [--iterations 5]

Actions:

  1. Load design image
  2. Extract dimensions (width, height)
  3. Analyze visual structure (layout, colors, fonts, spacing)
  4. Generate initial HTML/CSS

Example prompt:

Analyze this design mockup and generate HTML/CSS code that recreates it.

Design dimensions: {width}x{height}px
Key elements detected:
- Layout type: [grid/flex/block]
- Primary colors: [list]
- Font styles: [list]
- Spacing patterns: [list]

Generate complete HTML with inline CSS.

Step 2: Render & Compare (Iteration Loop)

Run comparison script for each iteration:

node scripts/compare.js <original-image> <html-file> <output-dir> <iteration>

Script outputs:

  • rendered_<n>.png - HTML screenshot
  • diff_<n>.png - Visual difference map
  • report_<n>.json - Comparison metrics

Comparison metrics:

  • matchScore - Pixel similarity percentage
  • diffPixels - Number of mismatched pixels
  • issues - List of detected problems

Step 3: Generate Diff Report

Report structure (passed to model):

{
  "iteration": 2,
  "matchScore": 78.5,
  "diffPixels": 21500,
  "issues": [
    {
      "type": "color",
      "location": {"x": 100, "y": 200, "w": 50, "h": 30},
      "description": "Button background color mismatch: expected #FF5733, got #FF5722",
      "severity": "medium"
    },
    {
      "type": "spacing",
      "location": {"x": 150, "y": 100, "w": 200, "h": 50},
      "description": "Padding mismatch: expected 20px, got 15px",
      "severity": "high"
    }
  ]
}

Step 4: Optimize HTML

Model prompt template:

## Iteration {iteration}/{maxIterations}

**Current match score**: {matchScore}%
**Target**: {threshold}%

**Issues detected**:
{issuesFormatted}

**Visual difference**: See diff_{iteration}.png

**Previous HTML**:

{previousHtml}


**Optimization instructions**:
1. Fix color mismatches (use exact hex values)
2. Correct spacing/padding issues
3. Adjust layout positioning
4. Match font sizes and weights

Output optimized HTML code only.

Step 5: Final Output

Completion criteria:

  • Match score ≥ threshold (default 95%)
  • OR completed max iterations (default 5)

Output package:

  • final.html - Final HTML/CSS code
  • comparison_report.md - Iteration history
  • rendered_final.png - Final screenshot
  • diff_final.png - Final comparison
  • timeline/ - All iteration screenshots

Scripts

render.js

Render HTML to PNG screenshot using Puppeteer.

node scripts/render.js <html-file> <output-image> [--width 1920] [--height 1080]

compare.js

Pixel-level comparison using pixelmatch.

node scripts/compare.js <original> <rendered> <diff-output> [--threshold 0.1]

analyze.js

Analyze design image structure.

node scripts/analyze.js <image-file> <output-json>

pipeline.js

Run full iteration pipeline.

node scripts/pipeline.js <original-image> [--threshold 95] [--iterations 5] [--output-dir ./output]

Setup

Install dependencies:

cd ~/.openclaw/skills/design-to-html
npm install

Dependencies:

  • puppeteer - HTML rendering
  • pixelmatch - Pixel comparison
  • pngjs - PNG processing
  • sharp - Image analysis

Examples

Simple button design

Input: button.png (200x50px)
Iterations: 3
Final score: 96.2%
Time: ~25s

Card component

Input: card.png (400x300px)
Iterations: 5
Final score: 91.8%
Time: ~45s

Full page layout

Input: landing-page.png (1920x1080px)
Iterations: 5
Final score: 87.5%
Time: ~90s

Tips

  1. Higher threshold → More iterations, better accuracy
  2. Larger images → More diff pixels, harder to reach threshold
  3. Complex layouts → May need manual tweaks after automation
  4. Color precision → Use exact hex values from design
  5. Font matching → Specify exact font-family, size, weight

Limitations

  • Requires Node.js + Puppeteer (headless Chrome)
  • May struggle with:

- Complex gradients - SVG icons - Custom fonts (not web-safe) - Animations/transitions

  • Best for static, flat designs

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

75.15%
按下载量换算273

安全审计

VirusTotal

可疑

ClawScan

通过

Static analysis

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills