glassmorphism
它能做什么
为应用或网站界面创建“毛玻璃”视觉效果。它会让元素背后的背景轻微模糊并带有一定透明度,就像透过玻璃看东西一样。
适用场景
- ✓当你想要现代、简洁的外观时。
- ✓想要让某个元素在色彩丰富或带有图片的背景上更加醒目时。
- ✓希望呈现受 macOS 启发的视觉风格时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/design-it/glassmorphism/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“创建一个按钮,放在蓝紫色渐变背景上,并带有毛玻璃效果。”
每周 5 个新技能,1 分钟读完。
工作原理
这是通过编程技术实现的,让元素背后的内容变得模糊,同时使元素部分透明。就像透过一扇起雾的窗户看东西。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Glassmorphism
"Looking through a frosted window. Interfaces that blend seamlessly with vibrant backgrounds."
When to Use
Use this sub-style when the user's request matches the aesthetic described above. This is a child reference of the design-it skill and is not meant to be triggered directly.
Core Principles
- Background Blur (Backdrop Filter): The defining characteristic. Elements blur whatever is underneath them.
- Semi-transparent White/Dark Backgrounds: Panels use rgba() colors to let the background shine through.
- Subtle Light Borders: A 1px semi-transparent white (or light) border to simulate the glass edge catching the light.
Visual DNA
- Colors: Requires a vibrant or textured background to work (e.g., gradients, abstract meshes, or photos). Works beautifully over Yacht Club or Earth-Grounded Elegance if there is underlying visual texture.
- Typography: Clean, geometric sans-serifs. High contrast text (pure white or pure black) is required for legibility against the glass.
- Shadows: Soft, subtle drop shadows to detach the glass pane from the background.
Web Implementation
- Rely heavily on
backdrop-filter: blur(). - CSS Example:
body {
/* Requires a complex background to see the glass effect */
background: url('abstract-mesh.jpg') cover;
}
.glass-panel {
background: rgba(255, 255, 255, 0.15); /* Light glass */
/* OR background: rgba(0, 0, 0, 0.25); for Dark glass */
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.3); /* The glass edge */
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
padding: 32px;
}
App Implementation
SwiftUI
struct GlassCard: View {
var body: some View {
ZStack {
// Vibrant background required for glass to show
LinearGradient(
colors: [.purple, .blue, .cyan],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
.ignoresSafeArea()
// Glass panel
VStack(alignment: .leading, spacing: 16) {
Text("Glass Panel")
.font(.system(size: 22, weight: .semibold))
.foregroundColor(.white)
Text("Content floating on frosted glass.")
.font(.system(size: 15))
.foregroundColor(.white.opacity(0.8))
Button(action: {}) {
Text("Continue")
.font(.system(size: 15, weight: .semibold))
.foregroundColor(.white)
.padding(.horizontal, 24)
.padding(.vertical, 12)
.background(.ultraThinMaterial)
.cornerRadius(8)
}
}
.padding(24)
.background(.ultraThinMaterial) // Built-in frosted glass
.cornerRadius(16)
.overlay(
RoundedRectangle(cornerRadius: 16)
.stroke(.white.opacity(0.3), lineWidth: 1) // Glass edge highlight
)
.shadow(color: .black.opacity(0.1), radius: 20, x: 0, y: 10)
.padding(24)
}
}
}
- Use
.ultraThinMaterial,.thinMaterial,.regularMaterial,.thickMaterial— Apple built glassmorphism natively. - Add
.overlay(RoundedRectangle().stroke(.white.opacity(0.3)))for the light edge catch. - Glass only works if there's a vibrant background visible behind it.
Flutter
class GlassCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
// Vibrant background
Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Colors.purple, Colors.blue, Colors.cyan],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
),
// Glass panel
Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
…
常见问题
它需要花哨的背景才能生效吗?
需要。毛玻璃效果在背后有丰富色彩、渐变或有趣图片时效果最好。
我可以在任何地方使用吗?
它是一种设计风格,所以可以应用于按钮、面板、卡片或任何需要独特外观的元素。
实现起来难吗?
实现需要一些特定代码(网页使用 CSS,应用可以用 SwiftUI、Flutter 等语言),但核心思路就是创建模糊和透明效果。
详情
作者的原始描述
Web and App implementation guide for Glassmorphism. Trigger when user wants a frosted glass effect, blurred backgrounds, transparency, or a sleek MacOS-like feel.
热度
- GitHub 星标
- 48k
- 排名
- #4399
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。