ui-wireframe-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKatsuragi UI Wireframe Generator
Katsuragi UI线框图生成工具
Generate text-based UI wireframes using file syntax. Katsuragi converts simple declarative files into SVG/PNG images, serving as a communication medium for UI discussions.
.kui使用文件语法生成基于文本的UI线框图。Katsuragi可将简洁的声明式文件转换为SVG/PNG图片,作为UI设计讨论的沟通媒介。
.kuiInstall
安装步骤
bash
undefinedbash
undefinedInstall this skill
Install this skill
npx skills add enlinks-llc/katsuragi
npx skills add enlinks-llc/katsuragi
Install katsuragi CLI
Install katsuragi CLI
npm install -g katsuragi
npm install -g katsuragi
or use directly with npx
or use directly with npx
npx ktr input.kui -o output.png
undefinednpx ktr input.kui -o output.png
undefinedWhy Katsuragi?
为什么选择Katsuragi?
- LLM-friendly: Text-based format that AI agents can read, write, and iterate on
- Human-readable: Simple syntax anyone can understand without design tools
- Git-friendly: Version control your wireframes alongside code
- Zero design skills needed: Grid-based layout handles positioning automatically
- Instant output: Generate PNG/SVG in seconds via CLI
- LLM友好:基于文本的格式,AI Agent可读取、编写并迭代
- 易读性强:语法简洁,无需设计工具即可理解
- Git友好:可将线框图与代码一同进行版本控制
- 无需设计技能:基于网格的布局自动处理元素定位
- 输出即时:通过CLI几秒内即可生成PNG/SVG图片
Use Cases
适用场景
- Developer ↔ Stakeholder communication: Show rough UI ideas without Figma
- AI-assisted UI development: Let LLMs propose layouts in format
.kui - Quick prototyping: Sketch screen layouts before writing any frontend code
- Documentation: Embed wireframes in technical specs and PRs
- Design discussions: Iterate on layouts through text diffs
- Reverse engineering: Convert existing webpages to wireframes with
.kuiktr fetch
- 开发者与利益相关者沟通:无需Figma即可展示大致UI想法
- AI辅助UI开发:让LLM以格式提出布局方案
.kui - 快速原型制作:在编写前端代码前勾勒屏幕布局
- 文档编写:将线框图嵌入技术规范和PR中
- 设计讨论:通过文本差异迭代布局方案
- 逆向工程:使用将现有网页转换为
ktr fetch线框图.kui
When to Use
使用时机
- Creating quick UI wireframes or mockups
- Discussing UI layouts with stakeholders
- Generating visual representations of UI designs
- Documenting UI structures in a text-based format
- 创建快速UI线框图或原型图
- 与利益相关者讨论UI布局
- 生成UI设计的可视化表示
- 以文本格式记录UI结构
Quick Start
快速开始
To generate a wireframe:
bash
npx ktr input.kui -o output.png # PNG output
npx ktr input.kui -o output.svg # SVG output要生成线框图:
bash
npx ktr input.kui -o output.png # PNG output
npx ktr input.kui -o output.svg # SVG outputFetch Command
Fetch命令
Convert existing webpages to wireframes:
.kuibash
undefined将现有网页转换为线框图:
.kuibash
undefinedBasic usage
Basic usage
npx ktr fetch https://example.com -o output.kui
npx ktr fetch https://example.com -o output.kui
With viewport option (desktop, mobile, tablet)
With viewport option (desktop, mobile, tablet)
npx ktr fetch https://example.com -o output.kui --viewport mobile
npx ktr fetch https://example.com -o output.kui --viewport mobile
With custom grid and ratio
With custom grid and ratio
npx ktr fetch https://example.com -o output.kui --grid 6x4 --ratio 4:3
undefinednpx ktr fetch https://example.com -o output.kui --grid 6x4 --ratio 4:3
undefinedOptions
选项参数
| Option | Description | Default |
|---|---|---|
| Output .kui file path (required) | - |
| Target viewport: desktop, mobile, tablet | desktop |
| Override grid size (e.g., 4x3) | auto |
| Override aspect ratio (e.g., 16:9) | auto |
| 选项 | 描述 | 默认值 |
|---|---|---|
| 输出.kui文件路径(必填) | - |
| 目标视口类型:desktop、mobile、tablet | desktop |
| 自定义网格尺寸(例如:4x3) | auto |
| 自定义宽高比(例如:16:9) | auto |
How It Works
工作原理
- Fetches HTML from the URL (no headless browser)
- Extracts as the primary color for the
<meta name="theme-color">headercolors - Extracts inline style colors (,
background-color) per elementborder-color - Parses DOM to extract visual elements (header, nav, main, footer, buttons, inputs, etc.)
- Auto-calculates optimal grid size based on element positions
- Maps HTML elements to kui components with real content:
- ,
header,nav, etc. →footerwith semantic labels ("Header", "Navigation", "Footer")txt - →
buttonwith actual button textbtn - ,
input,textarea→selectwith placeholder or type-based labelinput - →
imgwith alt textimg - -
h1,h6,p,span(with text) →labelwith actual text content (truncated)txt
- Applies extracted colors to component and
bgpropertiesborder - Generates file with cell assignments
.kui
- 从URL获取HTML内容(无需无头浏览器)
- 提取作为
<meta name="theme-color">头部的主色调colors - 提取每个元素的内联样式颜色(、
background-color)border-color - 解析DOM结构提取视觉元素(header、nav、main、footer、按钮、输入框等)
- 根据元素位置自动计算最优网格尺寸
- 将HTML元素映射为带真实内容的kui组件:
- 、
header、nav等 → 带语义标签的footer组件(如"Header"、"Navigation"、"Footer")txt - → 带实际按钮文本的
button组件btn - 、
input、textarea→ 带占位符或基于类型标签的select组件input - → 带替代文本的
img组件img - -
h1、h6、p、span(含文本)→ 带实际文本内容的label组件(内容会截断)txt
- 将提取的颜色应用到组件的和
bg属性border - 生成包含单元格分配的文件
.kui
Limitations
局限性
- No CSS parsing (structure-based analysis only)
- No JavaScript execution (SPA not supported)
- Maximum grid size: 26×26
- Text content is truncated for wireframe display (max 20-30 characters)
- 不支持CSS解析(仅基于结构分析)
- 不支持JavaScript执行(无法处理SPA)
- 最大网格尺寸:26×26
- 文本内容会被截断以适配线框显示(最多20-30个字符)
File Structure
文件结构
Every file follows this structure:
.kuikui
ratio: 16:9 // Canvas aspect ratio
grid: 4x3 // Grid dimensions (columns x rows)
gap: 8 // Space between cells (optional)
padding: 16 // Canvas padding (optional)
colors: { name: "#hex" } // Color definitions (optional)
// Cell definitions
A1..B2: { type: component, property: value }每个文件遵循以下结构:
.kuikui
ratio: 16:9 // Canvas aspect ratio
grid: 4x3 // Grid dimensions (columns x rows)
gap: 8 // Space between cells (optional)
padding: 16 // Canvas padding (optional)
colors: { name: "#hex" } // Color definitions (optional)
// Cell definitions
A1..B2: { type: component, property: value }Grid System
网格系统
Cells use Excel-style notation:
- Single cell: (column A, row 1)
A1 - Range: (merges cells from A1 to B2)
A1..B2 - Columns: A, B, C, D... (left to right)
- Rows: 1, 2, 3... (top to bottom)
Grid divides canvas equally. A 4x3 grid creates 4 equal columns and 3 equal rows.
单元格采用类似Excel的标记方式:
- 单个单元格:(A列,第1行)
A1 - 单元格范围:(合并从A1到B2的单元格)
A1..B2 - 列:A、B、C、D...(从左到右)
- 行:1、2、3...(从上到下)
网格将画布均等划分。4x3的网格会创建4个等宽列和3个等高行。
Components
组件
| Type | Purpose | Key Properties |
|---|---|---|
| Text label | |
| Empty container | |
| Button | |
| Form input | |
| Image placeholder | |
| 类型 | 用途 | 关键属性 |
|---|---|---|
| 文本标签 | |
| 空容器 | |
| 按钮 | |
| 表单输入框 | |
| 图片占位符 | |
Common Properties
通用属性
| Property | Values | Default |
|---|---|---|
| | |
| Color (hex, name, or | |
| Color (hex, name, or | none |
| Number (pixels) | |
| 属性 | 取值 | 默认值 |
|---|---|---|
| | |
| 颜色(十六进制、颜色名称或 | |
| 颜色(十六进制、颜色名称或 | none |
| 数值(像素) | |
Color System
颜色系统
Define reusable colors in the header:
kui
colors: { primary: "#3B82F6", danger: "#EF4444", accent: "orange" }
// Use with $ prefix
D3: { type: btn, value: "Submit", bg: $primary }Supported formats: , , CSS color names
#RGB#RRGGBB在头部定义可复用的颜色:
kui
colors: { primary: "#3B82F6", danger: "#EF4444", accent: "orange" }
// Use with $ prefix
D3: { type: btn, value: "Submit", bg: $primary }支持的格式:、、CSS颜色名称
#RGB#RRGGBBOutput Specifications
输出规格
- Longest edge: Fixed at 1280px
- Aspect ratios: → 1280×720,
16:9→ 1280×960,4:3→ 720×12809:16
- 最长边:固定为1280px
- 宽高比:→ 1280×720,
16:9→ 1280×960,4:3→ 720×12809:16
Syntax Reference
语法参考
For complete syntax details, see .
references/syntax.md完整语法细节请查看。
references/syntax.mdExamples
示例
Login Form
登录表单
kui
ratio: 16:9
grid: 4x3
gap: 8
padding: 16
colors: { primary: "#3B82F6" }
// Header
A1..D1: { type: txt, value: "Login", align: center }
// Form fields
A2..D2: { type: input, label: "Email" }
A3..C3: { type: input, label: "Password" }
// Submit button
D3: { type: btn, value: "Login", bg: $primary }kui
ratio: 16:9
grid: 4x3
gap: 8
padding: 16
colors: { primary: "#3B82F6" }
// Header
A1..D1: { type: txt, value: "Login", align: center }
// Form fields
A2..D2: { type: input, label: "Email" }
A3..C3: { type: input, label: "Password" }
// Submit button
D3: { type: btn, value: "Login", bg: $primary }Dashboard Layout
仪表盘布局
kui
ratio: 16:9
grid: 4x3
gap: 8
padding: 16
colors: { secondary: "#f5f5f5", outline: "#333" }
// Navigation
A1: { type: img, alt: "Logo" }
B1..C1: { type: txt, value: "Dashboard", align: center }
D1: { type: btn, value: "Logout", border: $outline }
// Sidebar
A2..A3: { type: box, bg: $secondary }
// Main content area
B2..D2: { type: txt, value: "Welcome back!", align: left }
B3..D3: { type: box, border: $outline }kui
ratio: 16:9
grid: 4x3
gap: 8
padding: 16
colors: { secondary: "#f5f5f5", outline: "#333" }
// Navigation
A1: { type: img, alt: "Logo" }
B1..C1: { type: txt, value: "Dashboard", align: center }
D1: { type: btn, value: "Logout", border: $outline }
// Sidebar
A2..A3: { type: box, bg: $secondary }
// Main content area
B2..D2: { type: txt, value: "Welcome back!", align: left }
B3..D3: { type: box, border: $outline }Mobile Profile (Vertical)
移动端个人资料(竖屏)
kui
ratio: 9:16
grid: 3x5
gap: 8
padding: 16
colors: { primary: "#3B82F6", outline: "#333" }
// Header
A1..C1: { type: txt, value: "My App", align: center }
// Profile image
A2..C2: { type: img, alt: "Profile Photo" }
// User info
A3..C3: { type: txt, value: "John Doe", align: center }
// Actions
A4..C4: { type: btn, value: "Edit Profile", bg: $primary }
A5..C5: { type: btn, value: "Settings", border: $outline }kui
ratio: 9:16
grid: 3x5
gap: 8
padding: 16
colors: { primary: "#3B82F6", outline: "#333" }
// Header
A1..C1: { type: txt, value: "My App", align: center }
// Profile image
A2..C2: { type: img, alt: "Profile Photo" }
// User info
A3..C3: { type: txt, value: "John Doe", align: center }
// Actions
A4..C4: { type: btn, value: "Edit Profile", bg: $primary }
A5..C5: { type: btn, value: "Settings", border: $outline }Workflow
工作流程
- Define the canvas - Set ratio and grid size based on target layout
- Plan the grid - Sketch cell positions mentally or on paper
- Write .kui file - Start with header, then define cells top-to-bottom
- Generate output - Run
npx ktr file.kui -o output.png - Iterate - Adjust grid, spacing, or components as needed
- 定义画布 - 根据目标布局设置宽高比和网格尺寸
- 规划网格 - 在脑中或纸上勾勒单元格位置
- 编写.kui文件 - 先编写头部信息,再从上到下定义单元格
- 生成输出文件 - 运行命令
npx ktr file.kui -o output.png - 迭代优化 - 根据需要调整网格、间距或组件
Best Practices
最佳实践
- Use meaningful color names in the block
colors - Add comments () to organize sections
// - Start with larger merged cells for main areas, then refine
- Use for clean separation between elements
gap - Test with both SVG and PNG to choose the best format
- 在块中使用有意义的颜色名称
colors - 添加注释()来划分不同区域
// - 先为主要区域使用大的合并单元格,再进行细化
- 使用属性实现元素间的清晰分隔
gap - 同时测试SVG和PNG格式以选择最合适的输出类型