get-shit-pretty 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -9
- package/agents/{gsp-accessibility-auditor.md → gsp-auditor.md} +17 -14
- package/agents/gsp-brand-auditor.md +97 -0
- package/agents/gsp-brand-strategist.md +64 -27
- package/agents/{gsp-design-engineer.md → gsp-builder.md} +12 -9
- package/agents/gsp-campaign-director.md +50 -11
- package/agents/gsp-codebase-scanner.md +171 -0
- package/agents/gsp-critic.md +18 -13
- package/agents/gsp-designer.md +126 -0
- package/agents/gsp-identity-designer.md +90 -0
- package/agents/gsp-project-researcher.md +102 -0
- package/agents/gsp-researcher.md +54 -18
- package/agents/gsp-reviewer.md +66 -0
- package/agents/gsp-scoper.md +103 -0
- package/agents/gsp-system-architect.md +91 -26
- package/agents/gsp-verbal-strategist.md +84 -0
- package/bin/install.js +161 -5
- package/commands/gsp/brand-audit.md +116 -0
- package/commands/gsp/brand-discover.md +17 -0
- package/commands/gsp/brand-identity.md +200 -0
- package/commands/gsp/brand-patterns.md +223 -0
- package/commands/gsp/brand-research.md +99 -0
- package/commands/gsp/brand-strategy.md +140 -0
- package/commands/gsp/brand-system.md +17 -0
- package/commands/gsp/brand-verbal.md +94 -0
- package/commands/gsp/brand.md +9 -83
- package/commands/gsp/brief.md +142 -0
- package/commands/gsp/build.md +49 -41
- package/commands/gsp/critique.md +140 -0
- package/commands/gsp/design.md +65 -50
- package/commands/gsp/discover.md +17 -0
- package/commands/gsp/doctor.md +319 -0
- package/commands/gsp/help.md +85 -38
- package/commands/gsp/identity.md +18 -0
- package/commands/gsp/launch.md +55 -35
- package/commands/gsp/new-project.md +5 -86
- package/commands/gsp/new.md +237 -0
- package/commands/gsp/plan.md +18 -0
- package/commands/gsp/progress.md +58 -26
- package/commands/gsp/research.md +91 -34
- package/commands/gsp/review.md +115 -59
- package/commands/gsp/strategy.md +18 -0
- package/commands/gsp/system.md +8 -65
- package/commands/gsp/update.md +102 -0
- package/commands/gsp/verbal.md +18 -0
- package/package.json +2 -2
- package/prompts/01-design-system-architect.md +35 -3
- package/prompts/03-ui-ux-pattern-master.md +11 -1
- package/prompts/09-design-to-code-translator.md +9 -0
- package/prompts/10-project-scoper.md +51 -0
- package/prompts/11-deliverable-reviewer.md +58 -0
- package/prompts/12-project-researcher.md +57 -0
- package/references/brand-archetypes.md +151 -0
- package/references/brand-prism.md +138 -0
- package/references/chunk-format.md +48 -0
- package/references/design-trends.md +47 -0
- package/references/positioning-frameworks.md +197 -0
- package/references/questioning.md +1 -1
- package/references/trends/aurora-gradients.md +245 -0
- package/references/trends/bento-grid.md +473 -0
- package/references/trends/claymorphism.md +232 -0
- package/references/trends/dark-mode-oled.md +282 -0
- package/references/trends/glassmorphism.md +455 -0
- package/references/trends/kinetic-typography.md +277 -0
- package/references/trends/liquid-glass.md +236 -0
- package/references/trends/micro-interactions.md +307 -0
- package/references/trends/neubrutalism.md +276 -0
- package/references/voice-tone.md +193 -0
- package/scripts/gsp-statusline.js +1 -1
- package/templates/branding/brief.md +74 -0
- package/templates/branding/config.json +26 -0
- package/templates/branding/roadmap.md +43 -0
- package/templates/branding/state.md +29 -0
- package/templates/changelog.md +4 -0
- package/templates/codebase-inventory.md +71 -0
- package/templates/exports-index.md +93 -0
- package/templates/manifest.md +19 -0
- package/templates/phases/brief.md +53 -0
- package/templates/phases/build.md +24 -48
- package/templates/phases/critique.md +68 -0
- package/templates/phases/design.md +54 -32
- package/templates/phases/discover.md +60 -0
- package/templates/phases/identity.md +78 -0
- package/templates/phases/launch.md +48 -55
- package/templates/phases/research.md +75 -47
- package/templates/phases/review.md +27 -75
- package/templates/phases/strategy.md +67 -0
- package/templates/phases/system.md +84 -78
- package/templates/phases/verbal.md +63 -0
- package/templates/{project.md → projects/brief.md} +13 -17
- package/templates/projects/config.json +32 -0
- package/templates/projects/roadmap.md +59 -0
- package/templates/{state.md → projects/state.md} +19 -9
- package/agents/gsp-spec-engineer.md +0 -121
- package/agents/gsp-ui-designer.md +0 -59
- package/commands/gsp/spec.md +0 -88
- package/templates/config.json +0 -26
- package/templates/phases/brand.md +0 -60
- package/templates/phases/spec.md +0 -46
- package/templates/roadmap.md +0 -62
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
# Glassmorphism
|
|
2
|
+
|
|
3
|
+
> Frosted-glass UI aesthetic using backdrop blur, controlled transparency, and hairline borders to create depth through layered translucency.
|
|
4
|
+
|
|
5
|
+
Last verified: 2026-03-04
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Visual Characteristics
|
|
10
|
+
|
|
11
|
+
- **Translucent fill**: backgrounds use rgba with alpha in the 0.08–0.20 range — enough to hint at depth without obscuring content
|
|
12
|
+
- **Backdrop blur**: the defining property; blur(10–16px) is the current production sweet spot (see CSS section for verified ranges)
|
|
13
|
+
- **Hairline border**: 1px solid rgba(255,255,255,0.18–0.25) traces the glass edge and is critical for legibility against dark backgrounds
|
|
14
|
+
- **Layered depth hierarchy**: closer cards run slightly higher opacity and brightness than recessed ones
|
|
15
|
+
- **Ambient shadow**: a soft, large-radius box-shadow (not sharp drop-shadow) reinforces float
|
|
16
|
+
- **Gradient inset highlight**: a top-left-to-bottom-right linear-gradient inside the card simulates light hitting beveled glass
|
|
17
|
+
- 64% of premium SaaS apps now incorporate glassmorphism elements (2025 trend analysis)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## CSS Implementation
|
|
22
|
+
|
|
23
|
+
### Light Variant
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
.glass {
|
|
27
|
+
/* Fill: 0.08–0.15 alpha is the reliable readable range */
|
|
28
|
+
background: rgba(255, 255, 255, 0.12);
|
|
29
|
+
|
|
30
|
+
/* Blur: 10–16px is optimal — see Performance section for rationale */
|
|
31
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
32
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%); /* Required: Safari */
|
|
33
|
+
|
|
34
|
+
/* Hairline border — critical for edge definition */
|
|
35
|
+
border: 1px solid rgba(255, 255, 255, 0.20);
|
|
36
|
+
border-radius: 16px; /* cards: 16–20px | modals: 24–32px */
|
|
37
|
+
|
|
38
|
+
/* Ambient shadow: large spread, low opacity */
|
|
39
|
+
box-shadow:
|
|
40
|
+
0 8px 32px rgba(31, 38, 135, 0.20),
|
|
41
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.40); /* top highlight */
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.glass:hover {
|
|
45
|
+
background: rgba(255, 255, 255, 0.18);
|
|
46
|
+
border-color: rgba(255, 255, 255, 0.30);
|
|
47
|
+
box-shadow:
|
|
48
|
+
0 16px 48px rgba(31, 38, 135, 0.30),
|
|
49
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.50);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Dark Variant
|
|
54
|
+
|
|
55
|
+
```css
|
|
56
|
+
.glass-dark {
|
|
57
|
+
/* Dark fill: 0.20–0.35 alpha needed because dark is less "glassy" at low opacity */
|
|
58
|
+
background: rgba(10, 10, 20, 0.30);
|
|
59
|
+
backdrop-filter: blur(12px) saturate(150%);
|
|
60
|
+
-webkit-backdrop-filter: blur(12px) saturate(150%);
|
|
61
|
+
|
|
62
|
+
/* White border stays — it's the only edge definition on dark bg */
|
|
63
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
64
|
+
border-radius: 16px;
|
|
65
|
+
|
|
66
|
+
box-shadow:
|
|
67
|
+
0 8px 32px rgba(0, 0, 0, 0.50),
|
|
68
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.06);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Blur Sweet Spot Verification
|
|
73
|
+
|
|
74
|
+
The "8–15px" figure in most tutorials is slightly low for modern dense displays. Current evidence:
|
|
75
|
+
|
|
76
|
+
| Blur Value | Effect | Verdict |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| 4–6px | Barely perceptible, looks like low opacity only | Too weak |
|
|
79
|
+
| 8px | Soft suggestion of glass | Minimum viable |
|
|
80
|
+
| 10–12px | Classic frosted glass | Reliable sweet spot |
|
|
81
|
+
| 16px | Rich depth, still crisp text | Strong but watch GPU cost |
|
|
82
|
+
| 20–24px | Heavy fog; text contrast degrades | Limit to modals only |
|
|
83
|
+
| 50px+ | Exponential GPU cost, no visual gain | Never use |
|
|
84
|
+
|
|
85
|
+
Revised recommendation: **10–16px** for cards and navbars; **up to 20px** acceptable for full-screen modal overlays only.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Implementation Guide
|
|
90
|
+
|
|
91
|
+
### Step-by-step
|
|
92
|
+
|
|
93
|
+
1. **Prepare the canvas**: glassmorphism requires a visually rich background — gradient, photography, or aurora-style mesh. A flat color background renders the blur invisible.
|
|
94
|
+
|
|
95
|
+
2. **Set the fill**: start at `rgba(255,255,255,0.10)` for light mode. Increase alpha until text passes 4.5:1 WCAG contrast — do not rely on blur to do this work.
|
|
96
|
+
|
|
97
|
+
3. **Apply backdrop-filter**: use `blur(12px) saturate(180%)`. The `saturate` modifier prevents the blurred content from looking washed out.
|
|
98
|
+
|
|
99
|
+
4. **Add the hairline border**: `1px solid rgba(255,255,255,0.20)`. This is not decorative — it defines the glass edge. Without it the card dissolves into the background.
|
|
100
|
+
|
|
101
|
+
5. **Layer the shadows**: use a large-spread, low-opacity ambient shadow rather than a sharp drop shadow.
|
|
102
|
+
|
|
103
|
+
6. **Add inset highlight**: `inset 0 1px 0 rgba(255,255,255,0.40)` inside box-shadow simulates light hitting the top edge.
|
|
104
|
+
|
|
105
|
+
7. **Test text contrast**: measure actual contrast ratio with a tool. Do not eyeball it. Use a text-shadow or increase fill alpha if needed.
|
|
106
|
+
|
|
107
|
+
### Progressive Enhancement
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
/* Baseline: solid card for browsers without backdrop-filter support */
|
|
111
|
+
.glass {
|
|
112
|
+
background: rgba(255, 255, 255, 0.85);
|
|
113
|
+
border: 1px solid rgba(255, 255, 255, 0.30);
|
|
114
|
+
border-radius: 16px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Enhanced: backdrop-filter when supported */
|
|
118
|
+
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
|
|
119
|
+
.glass {
|
|
120
|
+
background: rgba(255, 255, 255, 0.12);
|
|
121
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
122
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Reduced transparency: respect OS-level accessibility preference */
|
|
127
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
128
|
+
.glass {
|
|
129
|
+
background: rgba(255, 255, 255, 0.85);
|
|
130
|
+
backdrop-filter: none;
|
|
131
|
+
-webkit-backdrop-filter: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Framework Notes
|
|
137
|
+
|
|
138
|
+
#### React + Tailwind CSS
|
|
139
|
+
|
|
140
|
+
Tailwind's `backdrop-blur-*` scale maps directly to production values:
|
|
141
|
+
|
|
142
|
+
| Class | Blur | Use Case |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `backdrop-blur-sm` | 8px | Subtle overlays |
|
|
145
|
+
| `backdrop-blur-md` | 12px | Cards, navbars (recommended default) |
|
|
146
|
+
| `backdrop-blur-lg` | 16px | Modals, drawers |
|
|
147
|
+
| `backdrop-blur-xl` | 24px | Full-screen overlays only |
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
// Glass card component — React + Tailwind
|
|
151
|
+
export function GlassCard({ children }: { children: React.ReactNode }) {
|
|
152
|
+
return (
|
|
153
|
+
<div
|
|
154
|
+
className={[
|
|
155
|
+
// Translucent fill
|
|
156
|
+
"bg-white/10",
|
|
157
|
+
// Backdrop blur — md is the safe default
|
|
158
|
+
"backdrop-blur-md",
|
|
159
|
+
// Saturate avoids washed-out look
|
|
160
|
+
"backdrop-saturate-150",
|
|
161
|
+
// Hairline border
|
|
162
|
+
"border border-white/20",
|
|
163
|
+
// Corners
|
|
164
|
+
"rounded-2xl",
|
|
165
|
+
// Ambient shadow
|
|
166
|
+
"shadow-[0_8px_32px_rgba(31,38,135,0.20)]",
|
|
167
|
+
].join(" ")}
|
|
168
|
+
>
|
|
169
|
+
{children}
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Dark variant — add to className or wrap in dark: variants
|
|
175
|
+
// "dark:bg-black/30 dark:border-white/[0.08] dark:shadow-[0_8px_32px_rgba(0,0,0,0.50)]"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
For the `@supports` fallback in Tailwind, add this to your global CSS — Tailwind utilities cannot express `@supports` conditions directly:
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
@supports not (backdrop-filter: blur(1px)) {
|
|
182
|
+
.backdrop-blur-md,
|
|
183
|
+
.backdrop-blur-lg,
|
|
184
|
+
.backdrop-blur-xl {
|
|
185
|
+
background-color: rgba(255, 255, 255, 0.85) !important;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### React Native
|
|
191
|
+
|
|
192
|
+
Use `@react-native-community/blur` — the only production-stable blur library as of 2025.
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
import { BlurView } from "@react-native-community/blur";
|
|
196
|
+
|
|
197
|
+
export function GlassCard({ children }: { children: React.ReactNode }) {
|
|
198
|
+
return (
|
|
199
|
+
<BlurView
|
|
200
|
+
style={{
|
|
201
|
+
borderRadius: 16,
|
|
202
|
+
overflow: "hidden", // Required: clips blur to border radius
|
|
203
|
+
borderWidth: 1,
|
|
204
|
+
borderColor: "rgba(255,255,255,0.18)",
|
|
205
|
+
}}
|
|
206
|
+
blurType="light" // "light" | "dark" | "xlight" | "prominent"
|
|
207
|
+
blurAmount={10} // Maps to blur(px) — 8–16 recommended
|
|
208
|
+
reducedTransparencyFallbackColor="rgba(255,255,255,0.85)"
|
|
209
|
+
>
|
|
210
|
+
{children}
|
|
211
|
+
</BlurView>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Note: `BlurView` on Android uses a software renderer fallback — blur values above 16 cause visible lag on mid-range devices. Clamp to 10 for Android targets.
|
|
217
|
+
|
|
218
|
+
#### Vanilla CSS
|
|
219
|
+
|
|
220
|
+
```css
|
|
221
|
+
:root {
|
|
222
|
+
--glass-fill-light: rgba(255, 255, 255, 0.12);
|
|
223
|
+
--glass-fill-dark: rgba(10, 10, 20, 0.30);
|
|
224
|
+
--glass-blur: 12px;
|
|
225
|
+
--glass-saturate: 180%;
|
|
226
|
+
--glass-border-light: rgba(255, 255, 255, 0.20);
|
|
227
|
+
--glass-border-dark: rgba(255, 255, 255, 0.08);
|
|
228
|
+
--glass-radius-card: 16px;
|
|
229
|
+
--glass-radius-modal: 28px;
|
|
230
|
+
--glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.20);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.glass {
|
|
234
|
+
background: var(--glass-fill-light);
|
|
235
|
+
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
|
|
236
|
+
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
|
|
237
|
+
border: 1px solid var(--glass-border-light);
|
|
238
|
+
border-radius: var(--glass-radius-card);
|
|
239
|
+
box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.40);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (prefers-color-scheme: dark) {
|
|
243
|
+
.glass {
|
|
244
|
+
background: var(--glass-fill-dark);
|
|
245
|
+
border-color: var(--glass-border-dark);
|
|
246
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.06);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Common Pitfalls
|
|
252
|
+
|
|
253
|
+
1. **Glass on a flat background**: the blur effect has nothing to blur — the card looks like a faded rectangle. Always require a visually complex background layer.
|
|
254
|
+
|
|
255
|
+
2. **Omitting `-webkit-backdrop-filter`**: Safari requires the prefix. Without it, glass cards appear as solid opaque blocks on iOS and macOS Safari.
|
|
256
|
+
|
|
257
|
+
3. **Relying on blur for text legibility**: blur softens backgrounds but does not guarantee WCAG contrast. Always verify actual contrast ratio and increase fill alpha or add `text-shadow` if needed.
|
|
258
|
+
|
|
259
|
+
4. **Animating `backdrop-filter`**: transitioning blur values triggers layer compositing on every frame. If you must animate, animate `opacity` or `transform` instead — not the blur value itself.
|
|
260
|
+
|
|
261
|
+
5. **Too many glass elements per viewport**: performance degrades noticeably on mobile above 5 simultaneous glass elements. On mid-range Android, 10+ elements causes measurable frame drops.
|
|
262
|
+
|
|
263
|
+
6. **Missing `overflow: hidden` on bordered containers**: in some browsers, `backdrop-filter` bleeds outside `border-radius` without explicit overflow clipping. Add `overflow: hidden` to the container.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Examples Gallery
|
|
268
|
+
|
|
269
|
+
### 1. Nike After Dark Tour (Website)
|
|
270
|
+
Campaign site for Nike's global after-dark running events. Glassmorphic panels separate navigational and decorative layers — CTA chips sit on frosted glass so they read over photo backgrounds without obscuring the imagery. Route distance markers use the same treatment. Demonstrates glassmorphism as functional information hierarchy, not decoration.
|
|
271
|
+
|
|
272
|
+
### 2. AnyDistance (iOS Training App)
|
|
273
|
+
Uses heavy blur and higher opacity glass containers for the workout selector and Start button — contexts where legibility is non-negotiable. Collectibles and Stats sections layer glass cards over gradient backgrounds. The depth stacking is explicit: top-layer cards are slightly brighter and less opaque than recessed ones, which creates a tactile sense of card height.
|
|
274
|
+
|
|
275
|
+
### 3. The General Intelligence Company (Homepage)
|
|
276
|
+
Glass navigation bar over a vivid pixel-art skyline backdrop. Uses high blur (estimated 16–20px) with low opacity (~0.08–0.10) so the background illustration remains a visual feature rather than being obliterated. Demonstrates that glassmorphism can coexist with illustration-heavy art direction.
|
|
277
|
+
|
|
278
|
+
### 4. Henning Tillmann — Glassmorphism Dark & Light Theme (Awwwards Inspiration)
|
|
279
|
+
Designer showcase featured on Awwwards demonstrating glassmorphism adapted across both color schemes using CSS custom properties for theme switching. Cards, modals, buttons, and form inputs all carry the glass treatment with consistent variable-driven tokens. The Awwwards community cited it as a reference implementation for production-grade theming.
|
|
280
|
+
|
|
281
|
+
### 5. Apple macOS / iOS (System UI)
|
|
282
|
+
The canonical reference. macOS Sonoma and iOS 18 use blur(20px) with adaptive tint values that read the luminance of background content and adjust fill opacity accordingly — lighter fill over light content, darker fill over dark content. Apple's 2025 Liquid Glass evolution adds physically accurate lensing and real-time refraction, extending glassmorphism into a fully dynamic material. All web implementations are approximations of this system-level capability.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Accessibility
|
|
287
|
+
|
|
288
|
+
### Contrast Requirements
|
|
289
|
+
|
|
290
|
+
WCAG 2.2 AA minimums apply regardless of the glass aesthetic:
|
|
291
|
+
- Normal text (under 18pt / 14pt bold): **4.5:1** contrast ratio minimum
|
|
292
|
+
- Large text and UI component boundaries: **3:1** minimum
|
|
293
|
+
|
|
294
|
+
Glass surfaces introduce a dynamic background that changes as the user scrolls or as content shifts behind the panel. This means you cannot measure contrast against a static color — measure against the lightest plausible background value that will appear behind the element.
|
|
295
|
+
|
|
296
|
+
### Practical Strategies
|
|
297
|
+
|
|
298
|
+
```css
|
|
299
|
+
/* Strategy 1: text-shadow for subtle lift on variable backgrounds */
|
|
300
|
+
.glass p,
|
|
301
|
+
.glass label {
|
|
302
|
+
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* Strategy 2: semi-opaque text backing for critical readable zones */
|
|
306
|
+
.glass .text-zone {
|
|
307
|
+
background: rgba(0, 0, 0, 0.15);
|
|
308
|
+
border-radius: 8px;
|
|
309
|
+
padding: 4px 8px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Strategy 3: increase fill alpha until text is readable — preferred over text-shadow */
|
|
313
|
+
/* Start at 0.10, step up by 0.05 until contrast passes */
|
|
314
|
+
|
|
315
|
+
/* Focus indicator — glass surfaces swallow default focus rings */
|
|
316
|
+
.glass :focus-visible {
|
|
317
|
+
outline: 3px solid rgba(255, 255, 255, 0.90);
|
|
318
|
+
outline-offset: 2px;
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Reduced Transparency
|
|
323
|
+
|
|
324
|
+
macOS and iOS expose a "Reduce Transparency" accessibility toggle. The CSS media query for this is `prefers-reduced-transparency: reduce`. As of 2025, browser support is limited but growing — include it alongside `@supports` fallbacks:
|
|
325
|
+
|
|
326
|
+
```css
|
|
327
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
328
|
+
.glass {
|
|
329
|
+
background: rgba(255, 255, 255, 0.90);
|
|
330
|
+
backdrop-filter: none;
|
|
331
|
+
-webkit-backdrop-filter: none;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Performance
|
|
339
|
+
|
|
340
|
+
### Benchmarks (2025 data)
|
|
341
|
+
|
|
342
|
+
| Scenario | Impact |
|
|
343
|
+
|---|---|
|
|
344
|
+
| 1–3 glass elements | Negligible on modern desktop and mobile |
|
|
345
|
+
| 4–5 glass elements | Slight GPU overhead, no visible lag |
|
|
346
|
+
| 6–9 glass elements | Measurable on mid-range Android (12–15fps drop) |
|
|
347
|
+
| 10+ glass elements | Noticeable lag on mid-range phones |
|
|
348
|
+
| Animated blur value | Compositing hit on every frame — avoid |
|
|
349
|
+
| blur > 20px | Exponential GPU cost with diminishing visual return |
|
|
350
|
+
|
|
351
|
+
Static `backdrop-filter` effects consume approximately 15–25% more GPU resources than equivalent opaque surfaces. The cost scales with element area, not count alone — a full-viewport glass panel is more expensive than 10 small cards.
|
|
352
|
+
|
|
353
|
+
### Optimization Techniques
|
|
354
|
+
|
|
355
|
+
```css
|
|
356
|
+
/* Hardware acceleration — create a GPU compositing layer */
|
|
357
|
+
.glass {
|
|
358
|
+
transform: translateZ(0); /* Force GPU layer */
|
|
359
|
+
will-change: transform; /* Hint — use sparingly, not globally */
|
|
360
|
+
isolation: isolate; /* Contain compositing context */
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Mobile: reduce blur for low-powered devices */
|
|
364
|
+
@media (max-width: 768px) {
|
|
365
|
+
.glass {
|
|
366
|
+
backdrop-filter: blur(8px) saturate(150%);
|
|
367
|
+
-webkit-backdrop-filter: blur(8px) saturate(150%);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/* Respect reduced motion — avoid blur animation */
|
|
372
|
+
@media (prefers-reduced-motion: reduce) {
|
|
373
|
+
.glass {
|
|
374
|
+
transition: none;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Do not apply `will-change: backdrop-filter` — it creates a stacking context that can break z-index layering in complex UIs. Use `will-change: transform` instead.
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## When to Use / When to Avoid
|
|
384
|
+
|
|
385
|
+
### Use When
|
|
386
|
+
|
|
387
|
+
- Cards or panels float over a rich visual background (photography, gradient, illustration)
|
|
388
|
+
- Navigation bars and toolbars that need to feel lightweight while remaining always-visible
|
|
389
|
+
- Modal dialogs — blur reinforces focus by softening the background
|
|
390
|
+
- Dashboard widgets where depth hierarchy communicates data relationships
|
|
391
|
+
- Premium or luxury brand contexts where perceived quality justifies the GPU cost
|
|
392
|
+
|
|
393
|
+
### Avoid When
|
|
394
|
+
|
|
395
|
+
- The background is a flat color — the effect is invisible and the extra CSS is noise
|
|
396
|
+
- Text-heavy content (articles, documentation, forms) — transparency conflicts with sustained reading
|
|
397
|
+
- Performance-critical mobile experiences targeting low-end hardware
|
|
398
|
+
- High-density information displays where background bleed adds cognitive load
|
|
399
|
+
- Contexts where `prefers-reduced-transparency` users make up a significant portion of the audience
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Design Tokens
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"glass": {
|
|
408
|
+
"light": {
|
|
409
|
+
"fill": "rgba(255, 255, 255, 0.12)",
|
|
410
|
+
"fill-hover": "rgba(255, 255, 255, 0.18)",
|
|
411
|
+
"border": "rgba(255, 255, 255, 0.20)",
|
|
412
|
+
"border-hover": "rgba(255, 255, 255, 0.30)",
|
|
413
|
+
"blur": "12px",
|
|
414
|
+
"saturate": "180%",
|
|
415
|
+
"shadow": "0 8px 32px rgba(31, 38, 135, 0.20)",
|
|
416
|
+
"inset-highlight": "inset 0 1px 0 rgba(255, 255, 255, 0.40)"
|
|
417
|
+
},
|
|
418
|
+
"dark": {
|
|
419
|
+
"fill": "rgba(10, 10, 20, 0.30)",
|
|
420
|
+
"fill-hover": "rgba(10, 10, 20, 0.40)",
|
|
421
|
+
"border": "rgba(255, 255, 255, 0.08)",
|
|
422
|
+
"border-hover": "rgba(255, 255, 255, 0.14)",
|
|
423
|
+
"blur": "12px",
|
|
424
|
+
"saturate": "150%",
|
|
425
|
+
"shadow": "0 8px 32px rgba(0, 0, 0, 0.50)",
|
|
426
|
+
"inset-highlight": "inset 0 1px 0 rgba(255, 255, 255, 0.06)"
|
|
427
|
+
},
|
|
428
|
+
"radius": {
|
|
429
|
+
"card": "16px",
|
|
430
|
+
"card-large": "20px",
|
|
431
|
+
"modal": "28px",
|
|
432
|
+
"pill": "999px"
|
|
433
|
+
},
|
|
434
|
+
"blur-scale": {
|
|
435
|
+
"subtle": "8px",
|
|
436
|
+
"default": "12px",
|
|
437
|
+
"heavy": "16px",
|
|
438
|
+
"modal": "20px"
|
|
439
|
+
},
|
|
440
|
+
"fallback": {
|
|
441
|
+
"light": "rgba(255, 255, 255, 0.90)",
|
|
442
|
+
"dark": "rgba(20, 20, 30, 0.92)"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Related
|
|
451
|
+
|
|
452
|
+
- [Liquid Glass](./liquid-glass.md) — Apple's 2025 evolution: adds physically accurate lensing, refraction, and adaptive tint on top of the glassmorphism foundation
|
|
453
|
+
- [Aurora Gradients](./aurora-gradients.md) — the canonical background pairing; provides the visual richness that makes backdrop blur meaningful
|
|
454
|
+
- [Dark Mode OLED](./dark-mode-oled.md) — dark glassmorphism variant; OLED black backgrounds make glass panels pop without any ambient glow
|
|
455
|
+
- [Neumorphism](./neumorphism.md) — the competing depth metaphor; softer but requires monochrome backgrounds; often combined with glass for hybrid cards
|