适合场景
shader / webgl / gradient
Shader Gradient
以实时 WebGL 片元着色器驱动的流动网格渐变作背景的高端 SaaS 美学。近黑画布上一层缓慢呼吸的虹彩渐变场,冻毛玻璃内容面板悬浮其上,干净现代无衬线配一支明亮强调色——Stripe / Linear / Vercel 首屏的活体渐变。
适合场景
shader / webgl / gradient
设计重点
用真实 WebGL fragment shader 驱动流动渐变:全屏 quad + time / resolution uniform + fbm 噪声域扭曲
注意事项
禁止用静态渐变 PNG 或 CSS 关键帧假动画冒充实时着色器(廉价感的根源)
Showcase 入口
Showcase 页面的实时预览,点击查看完整体验。
配色方案
Primary
#08090D
Secondary
#EDEEF2
Accent 1
#7C5CFF
Accent 2
#22D3EE
AI 实现文档
默认用硬性提示词让 AI 直接生成前端;Design Spec 用来理解、改写和审核风格;Creative Brief 用来早期探索方向。
默认使用它:复制后追加具体需求,让 AI 直接生成一致、可落地的前端。
什么时候用
怎么用
STYLEKIT_STYLE_REFERENCE
style_name: 着色器渐变
style_slug: shader-gradient
style_source: /styles/shader-gradient
# Hard Prompt
## 什么时候用
当你希望 AI 严格按风格规则生成代码时使用。它是生产界面最稳的默认选择。
## 怎么用
- 把完整提示词复制到 ChatGPT、Claude、Cursor 或其他编码助手。
- 在提示词后追加具体产品、页面或组件需求。
- 生成后按禁止项和交互状态检查,确认没有风格漂移。
请严格遵守以下风格规则并保持一致性,禁止风格漂移。
## 执行要求
- 优先保证风格一致性,其次再做创意延展。
- 遇到冲突时以禁止项为最高优先级。
- 输出前自检:颜色、排版、间距、交互是否仍属于该风格。
## Style Rules
# Shader Gradient (着色器渐变) Design System
> 以实时 WebGL 片元着色器驱动的流动网格渐变作背景的高端 SaaS 美学。近黑画布上一层缓慢呼吸的虹彩渐变场,冻毛玻璃内容面板悬浮其上,干净现代无衬线配一支明亮强调色——Stripe / Linear / Vercel 首屏的活体渐变。
## 核心理念
着色器渐变的信条:背景不是一张图,而是一段永不重复的光。真正的实时着色器让首屏"活"了起来——渐变缓慢流动、色彩彼此渗透,像一块会呼吸的极光。这种活体感是高端 SaaS 的信号:它在说"我们连背景都亲手写了 shader",而不是随手贴了一张导出的渐变 PNG。
核心理念:
- 活体背景 = 高端信号:真正跑在 GPU 上的 fragment shader,噪声驱动的流动场,没有两帧完全相同。廉价感来自静态渐变或 CSS 关键帧假动画;高级感来自真 shader 的连续演化
- 克制是纪律:只有画布在动,DOM 绝不乱飞。所有 UI 动效只碰 transform / opacity,把 GPU 预算留给着色器。一个页面一块活体渐变就够了,不要满屏 canvas
- 近黑 + 虹彩:深近黑底 #08090D 让虹彩渐变(violet #7C5CFF / cyan #22D3EE / magenta #F472B6)发光。色相互相渗透而非硬切,靠 fbm 噪声域扭曲(domain warp)产生有机流动
- 冻毛玻璃承载内容:内容坐在 backdrop-blur 的玻璃面板上,1px white/10 描边,配暗色 scrim 保证文字对渐变场 4.5:1 对比。渐变是氛围,文字必须永远清晰
- 一支强调色:violet #7C5CFF 作唯一 UI 强调(主 CTA、焦点环、链接),其余交给玻璃与近黑。多个抢眼色会毁掉高级感
设计原则:
- 性能红线:devicePixelRatio 上限 2;IntersectionObserver 离屏即暂停 rAF、进屏恢复;单一全屏 quad + 一次编译的着色器,别每帧重建
- 降级链:prefers-reduced-motion 只渲染一帧静态画面(不起循环);WebGL 不可用回退到视觉近似的 CSS 静态渐变;移动端可降采样或直接静帧
- 无障碍与 CLS:canvas 纯装饰 aria-hidden;显式尺寸 / 固定容器高度防 CLS;内容层永远独立于 canvas,canvas 挂了页面照常可读
---
## Token 字典(精确 Class 映射)
### 边框
```
宽度: border
颜色: border-white/10
圆角: rounded-2xl
```
### 阴影
```
小: shadow-[0_2px_10px_rgba(0,0,0,0.4)]
中: shadow-[0_20px_60px_rgba(0,0,0,0.45)]
大: shadow-[0_30px_90px_rgba(0,0,0,0.55)]
悬停: hover:shadow-[0_24px_70px_rgba(124,92,255,0.25)]
聚焦: focus-visible:ring-2 focus-visible:ring-[#7C5CFF]/40
```
### 交互效果
```
悬停位移: undefined
过渡动画: transition-all duration-300 ease-out
按下状态: active:scale-[0.98]
```
### 字体
```
标题: font-semibold text-white tracking-tight
正文: text-white/70 leading-relaxed
```
### 字号
```
Hero: text-5xl md:text-7xl
H1: text-4xl md:text-6xl
H2: text-3xl md:text-4xl
H3: text-xl md:text-2xl
正文: text-base md:text-lg
小字: text-sm
```
### 间距
```
Section: py-24 md:py-32
容器: px-6 md:px-8
卡片: p-6
```
---
## [FORBIDDEN] 绝对禁止
以下 class 在本风格中**绝对禁止使用**,生成时必须检查并避免:
### 禁止的 Class
- `bg-gradient-to-r`
- `from-indigo-600`
- `via-purple-600`
- `to-pink-500`
- `animate-pulse`
- `duration-100`
### 禁止的模式
- 匹配 `^bg-gradient-to-r$`
- 匹配 `^animate-(pulse|bounce)$`
- 匹配 `^duration-100$`
### 禁止原因
- `bg-gradient-to-r`: Motion and color come from the WebGL shader, not decorative CSS gradients
- `from-indigo-600`: No AI-cliche gradient stops; the field is a real fbm shader over near-black
- `animate-pulse`: Do not fake life with CSS keyframes; the living quality is the real shader
- `duration-100`: The living gradient is calm and slow; snappy transitions break the premium feel
> WARNING: 如果你的代码中包含以上任何 class,必须立即替换。
---
## [REQUIRED] 必须包含
### 按钮必须包含
```
rounded-xl
transition-all duration-300
active:scale-[0.98]
```
### 卡片必须包含
```
bg-white/[0.06] backdrop-blur-2xl
border border-white/10
rounded-2xl
```
### 输入框必须包含
```
bg-white/[0.06] backdrop-blur-xl
border border-white/12
rounded-xl
text-white placeholder-white/40
focus:outline-none focus:border-[#7C5CFF]/70 focus:ring-2 focus:ring-[#7C5CFF]/25
transition-all duration-300
```
---
## [COMPARE] 错误 vs 正确对比
### 按钮
[WRONG] **错误示例**(使用了圆角和模糊阴影):
```html
<button class="rounded-lg shadow-lg bg-blue-500 text-white px-4 py-2 hover:bg-blue-600">
点击我
</button>
```
[CORRECT] **正确示例**(使用硬边缘、无圆角、位移效果):
```html
<button class="rounded-xl transition-all duration-300 active:scale-[0.98] bg-[#ff006e] text-white px-4 py-2 md:px-6 md:py-3">
点击我
</button>
```
### 卡片
[WRONG] **错误示例**(使用了渐变和圆角):
```html
<div class="rounded-xl shadow-2xl bg-gradient-to-r from-purple-500 to-pink-500 p-6">
<h3 class="text-xl font-semibold">标题</h3>
</div>
```
[CORRECT] **正确示例**(纯色背景、硬边缘阴影):
```html
<div class="bg-white/[0.06] backdrop-blur-2xl border border-white/10 rounded-2xl p-6">
<h3 class="font-semibold text-white tracking-tight text-xl md:text-2xl">标题</h3>
</div>
```
### 输入框
[WRONG] **错误示例**(灰色边框、圆角):
```html
<input class="rounded-md border border-gray-300 px-3 py-2 focus:ring-2 focus:ring-blue-500" />
```
[CORRECT] **正确示例**(黑色粗边框、聚焦阴影):
```html
<input class="bg-white/[0.06] backdrop-blur-xl border border-white/12 rounded-xl text-white placeholder-white/40 focus:outline-none focus:border-[#7C5CFF]/70 focus:ring-2 focus:ring-[#7C5CFF]/25 transition-all duration-300 px-3 py-2 md:px-4 md:py-3" placeholder="请输入..." />
```
---
## [TEMPLATES] 页面骨架模板
使用以下模板生成页面,只需替换 `{PLACEHOLDER}` 部分:
### 导航栏骨架
```html
<nav class="bg-white border-b-2 md:border-b-4 border-black px-4 md:px-8 py-3 md:py-4">
<div class="flex items-center justify-between max-w-6xl mx-auto">
<a href="/" class="font-black text-xl md:text-2xl tracking-wider">
{LOGO_TEXT}
</a>
<div class="flex gap-4 md:gap-8 font-mono text-sm md:text-base">
{NAV_LINKS}
</div>
</div>
</nav>
```
### Hero 区块骨架
```html
<section class="min-h-[60vh] md:min-h-[80vh] flex items-center px-4 md:px-8 py-12 md:py-0 bg-{ACCENT_COLOR} border-b-2 md:border-b-4 border-black">
<div class="max-w-4xl mx-auto">
<h1 class="font-black text-4xl md:text-6xl lg:text-8xl leading-tight tracking-tight mb-4 md:mb-6">
{HEADLINE}
</h1>
<p class="font-mono text-base md:text-xl max-w-xl mb-6 md:mb-8">
{SUBHEADLINE}
</p>
<button class="bg-black text-white font-black px-6 py-3 md:px-8 md:py-4 border-2 md:border-4 border-black shadow-[4px_4px_0px_0px_rgba(255,0,110,1)] md:shadow-[8px_8px_0px_0px_rgba(255,0,110,1)] hover:shadow-none hover:translate-x-[2px] hover:translate-y-[2px] transition-all text-sm md:text-base">
{CTA_TEXT}
</button>
</div>
</section>
```
### 卡片网格骨架
```html
<section class="py-12 md:py-24 px-4 md:px-8">
<div class="max-w-6xl mx-auto">
<h2 class="font-black text-2xl md:text-4xl mb-8 md:mb-12">{SECTION_TITLE}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6">
<!-- Card template - repeat for each card -->
<div class="bg-white border-2 md:border-4 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] md:shadow-[8px_8px_0px_0px_rgba(0,0,0,1)] p-4 md:p-6 hover:shadow-[4px_4px_0px_0px_rgba(255,0,110,1)] md:hover:shadow-[8px_8px_0px_0px_rgba(255,0,110,1)] hover:-translate-y-1 transition-all">
<h3 class="font-black text-lg md:text-xl mb-2">{CARD_TITLE}</h3>
<p class="font-mono text-sm md:text-base text-gray-700">{CARD_DESCRIPTION}</p>
</div>
</div>
</div>
</section>
```
### 页脚骨架
```html
<footer class="bg-black text-white py-12 md:py-16 px-4 md:px-8 border-t-2 md:border-t-4 border-black">
<div class="max-w-6xl mx-auto">
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<div>
<span class="font-black text-xl md:text-2xl">{LOGO_TEXT}</span>
<p class="font-mono text-sm mt-4 text-gray-400">{TAGLINE}</p>
</div>
<div>
<h4 class="font-black text-lg mb-4">{COLUMN_TITLE}</h4>
<ul class="space-y-2 font-mono text-sm text-gray-400">
{FOOTER_LINKS}
</ul>
</div>
</div>
</div>
</footer>
```
---
## [CHECKLIST] 生成后自检清单
**在输出代码前,必须逐项验证以下每一条。如有违反,立即修正后再输出:**
### 1. 圆角检查
- [ ] 搜索代码中的 `rounded-`
- [ ] 确认只有 `rounded-none` 或无圆角
- [ ] 如果发现 `rounded-lg`、`rounded-md` 等,替换为 `rounded-none`
### 2. 阴影检查
- [ ] 搜索代码中的 `shadow-`
- [ ] 确认只使用 `shadow-[Xpx_Xpx_0px_0px_rgba(...)]` 格式
- [ ] 如果发现 `shadow-lg`、`shadow-xl` 等,替换为正确格式
### 3. 边框检查
- [ ] 搜索代码中的 `border-`
- [ ] 确认边框颜色是 `border-black`
- [ ] 如果发现 `border-gray-*`、`border-slate-*`,替换为 `border-black`
### 4. 交互检查
- [ ] 所有按钮都有 `hover:shadow-none hover:translate-x-[2px] hover:translate-y-[2px]`
- [ ] 所有卡片都有 hover 效果(阴影变色或位移)
- [ ] 都包含 `transition-all`
### 5. 响应式检查
- [ ] 边框有 `border-2 md:border-4`
- [ ] 阴影有 `shadow-[4px...] md:shadow-[8px...]`
- [ ] 间距有 `p-4 md:p-6` 或类似的响应式值
- [ ] 字号有 `text-sm md:text-base` 或类似的响应式值
### 6. 字体检查
- [ ] 标题使用 `font-black`
- [ ] 正文使用 `font-mono`
> CRITICAL: **如果任何一项检查不通过,必须修正后重新生成代码。**
---
## [EXAMPLES] 示例 Prompt
### 1. SaaS 首屏落地页
着色器渐变背景的高端 SaaS 首屏
```
Create a premium SaaS landing hero with a real WebGL shader-gradient background:
1. A full-screen <canvas> WebGL fragment shader: a single quad, fbm domain-warped flowing field, uniforms u_res / u_time; near-black #08090D base with iridescent violet #7C5CFF, cyan #22D3EE and magenta #F472B6
2. Cap devicePixelRatio at 2, handle resize, and pause the rAF loop offscreen with an IntersectionObserver
3. prefers-reduced-motion renders one static frame; if WebGL is unavailable, fall back to a visually similar CSS radial-gradient background
4. Frosted-glass content panel (bg-white/[0.05], backdrop-blur-2xl, 1px white/10 border) holding the headline, subtext, and a single violet CTA plus a frosted secondary button
5. A frosted floating nav and a feature row of glass cards below the fold on quiet near-black sections
6. Only the canvas animates; all DOM motion is transform / opacity only; canvas aria-hidden and explicit heights to avoid CLS
```
### 2. 开发者产品首屏 + 着色器实验台
带可调 uniform 滑块的着色器渐变首屏
```
Create a developer-product hero on a living shader gradient, plus an interactive shader lab:
1. WebGL fragment-shader background (fbm flowing field, near-black #08090D + violet/cyan/magenta), dpr capped at 2, IntersectionObserver pause, reduced-motion single frame, CSS-gradient fallback when WebGL is missing
2. Glass hero panel with a monospace kicker, a bold sans headline, and one violet #7C5CFF CTA
3. A "shader lab" card with three sliders - speed, color blend, grain - each wired via useState/refs to the u_speed / u_blend / u_grain uniforms so the gradient responds live
4. A frosted stat strip and a pricing row of glass cards on near-black sections below
5. One accent only; DOM animation limited to transform / opacity; canvas aria-hidden with explicit sizes to prevent CLS
```
## 绝对禁止(匹配即拒绝)
以下模式一旦出现,视为风格违规——不找借口,直接重写。
- 用静态渐变 PNG 或 CSS 关键帧假动画冒充实时着色器(廉价感的根源)
- 不设 devicePixelRatio 上限(视网膜屏上像素爆炸、掉帧)
- 离屏还在跑 rAF 循环(白白烧电烧 GPU)
- 忽略 prefers-reduced-motion 或省略 WebGL 不可用回退
- 文字直接压渐变场不加玻璃面板 / scrim(对比不达标)
- 满屏多块 canvas 或多支抢眼强调色(毁掉高级克制感)
- 让 DOM 元素做位移 / 阴影动画抢着色器的 GPU 预算
## 自检清单(交付前逐条确认)
如果任何一条不通过,说明风格漂移了——修改后再交付。
- [ ] 没有紫色到蓝色的渐变
- [ ] 没有使用 Inter / Roboto / Geist 等过度使用的字体
- [ ] 没有嵌套卡片(卡片里面套卡片)
- [ ] 没有在彩色背景上放灰色文字
- [ ] 正文对比度满足 WCAG AA(≥4.5:1)
- [ ] 没有 bounce / elastic 缓动曲线
- [ ] 动效有 prefers-reduced-motion 备选方案
- [ ] 正文行宽不超过 65-75 个字符
- [ ] 没有单侧粗边框装饰(border-left/right accent stripe)
- [ ] 没有渐变文字(background-clip: text)
- [ ] 没有把玻璃态(glassmorphism)当作默认风格
- [ ] 没有 tiny uppercase tracked eyebrow 放在每个 section 标题上面
- [ ] 禁止用静态渐变 PNG 或 CSS 关键帧假动画冒充实时着色器(廉价感的根源)
- [ ] 禁止不设 devicePixelRatio 上限(视网膜屏上像素爆炸、掉帧)
- [ ] 禁止离屏还在跑 rAF 循环(白白烧电烧 GPU)
- [ ] 禁止忽略 prefers-reduced-motion 或省略 WebGL 不可用回退
- [ ] 禁止文字直接压渐变场不加玻璃面板 / scrim(对比不达标)在你的工作流里用它
一行命令,把这个风格的主题装进现有 shadcn 项目。
npx shadcn add https://www.stylekit.top/r/shader-gradient.json贡献者可在本地仓库构建尚未发布的 CLI。
pnpm --filter stylekit-cli build && node packages/cli/dist/index.js add shader-gradient贡献者可在本地仓库预览「着色器渐变」的 MCP 能力。
pnpm --filter stylekit-mcp build && node packages/mcp/dist/index.js组件模板
Violet accent CTA and a frosted-glass secondary
真实前端完成度
这层检查这个风格是否已经具备真实网站常见的主题、状态反馈、键盘可访问性和性能约束。
总体覆盖
51%
Fallback 规则
暗色模式
0%
缺失组件状态
79%
部分动效规则
70%
部分可访问性
70%
部分性能代价
35%
通用按钮
默认 / 悬停 / 键盘焦点 / 按下 / 禁用
输入框
默认 / 悬停 / 键盘焦点 / 禁用 / 错误
卡片
默认 / 悬停 / 键盘焦点 / 加载中 / 骨架屏
表单
默认 / 键盘焦点 / 禁用 / 加载中 / 错误
/* Shader Gradient Global Styles */
:root {
--sg-base: #08090D;
--sg-surface: #12131A;
--sg-paper: #EDEEF2;
--sg-violet: #7C5CFF;
--sg-cyan: #22D3EE;
--sg-magenta: #F472B6;
}
/* Full-bleed shader canvas base */
.sg-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
/* CSS static-gradient fallback (WebGL unavailable / under the canvas) */
.sg-fallback {
position: absolute;
inset: 0;
background:
radial-gradient(60% 60% at 28% 32%, rgba(124, 92, 255, 0.35), transparent 70%),
radial-gradient(55% 55% at 74% 58%, rgba(34, 211, 238, 0.22), transparent 70%),
radial-gradient(50% 60% at 55% 85%, rgba(244, 114, 182, 0.20), transparent 70%),
#08090D;
}
/* Frosted-glass panel */
.sg-glass {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(28px);
-webkit-backdrop-filter: blur(28px);
border: 1px solid rgba(255, 255, 255, 0.10);
border-radius: 1rem;
}
/* Readability scrim under text over the gradient */
.sg-scrim {
background: linear-gradient(to top, rgba(8, 9, 13, 0.7), rgba(8, 9, 13, 0.1) 55%, rgba(8, 9, 13, 0.35));
}
@media (prefers-reduced-motion: reduce) {
/* the shader loop is not started by script; a single static frame stays */
.sg-canvas { animation: none; }
}IDE 集成
下载 AI 编码助手的配置文件,使其按照此风格生成代码。
风格包
获取完整的可机器读取风格资源,包括 Design Tokens、Tailwind 预设、CSS 变量和 shadcn/ui 主题。
Metadata
Style metadata including version information
Design Tokens
Figma / Style Dictionary / Tokens Studio 兼容
Tailwind Preset
Tailwind CSS 主题预设,可直接在配置中引用
Global CSS
包含 CSS 变量和基础样式
shadcn Theme
shadcn/ui 主题配置
CSS Variables
纯 CSS 变量,适用于任何项目
SKILL.md
可加载到 Cursor / Claude Code / VS Code 的技能包
着色器渐变的信条:背景不是一张图,而是一段永不重复的光。真正的实时着色器让首屏"活"了起来——渐变缓慢流动、色彩彼此渗透,像一块会呼吸的极光。这种活体感是高端 SaaS 的信号:它在说"我们连背景都亲手写了 shader",而不是随手贴了一张导出的渐变 PNG。
基于颜色对比度和排版可读性的 WCAG 2.1 合规分析。
综合评分
等级: C - 一般
对比度
| 场景 | 颜色 | 比率 | AA | AAA |
|---|---|---|---|---|
| Text on background | /#ffffff / #08090D | 19.9:1 | ||
| Text on secondary background | /#ffffff / #12131A | 18.52:1 | ||
| Button primary | /#ffffff / #7C5CFF | 4.35:1 | ||
| Text on accent 1 | /#ffffff / #7C5CFF | 4.35:1 |
可读性
分数
85/100
字号
text-base md:text-lg
字重
font-semibold text-white tracking-tight
行高
default
评分基于 WCAG 2.1 标准。AA 级要求普通文本对比度 4.5:1、大文本 3:1;AAA 级要求普通文本 7:1、大文本 4.5:1。