Best For
diffraction grating / holographic foil / hot stamping
Holographic hot-stamping foil whose color is computed from a diffraction grating. The pointer is a lamp; rainbow bands sweep around it across every element, and silver, star, glitter, and pearl are different groove layouts.
Best For
diffraction grating / holographic foil / hot stamping
Primary Move
Compute color with the grating equation λ = d * |dot(h, k)| / m, d = 1500 nm, summing orders 1-3 at weights 1, 0.5, 0.3
Watch Out
Do not fake foil with a fixed rainbow gradient and an animated background-position
design.md
One document describes the colour roles, type rules, spacing and component construction behind this style. Copy or download it into Claude Code, Cursor, Codex or v0.
Light is the ink: let silver foil answer one shared lamp through a diffraction grating.
Theme: dark
The iridescence is not a rainbow gradient sliding over the page: it is computed from light diffracting through etched grooves. A 1500 nm grating under one lamp about 300 px above the screen produces the spectrum; wavelength follows the relative surface normal and lamp angle, while most of the surface stays silver. Diffraction orders 1, 2 and 3 are weighted 1, 0.5 and 0.3. A near-black print sheet and faint crop marks frame quiet, dimensional foil surfaces. The interactive page shares one WebGL2 context, with a CSS fallback driven by the same lamp.
| Name | Value | Token | Role |
|---|---|---|---|
| Print Sheet | #0c0b10 | --color-print-sheet | The near-black page ground, keeping the changing silver foil and spectrum in focus. |
| Panel | #141319 | --color-panel | Dark card and container fill, separated by a faint white hairline. |
| Dark Silver Foil | #a3a2af | --color-dark-silver | The silver-grey base for dark foil; iridescence overlays it only at matching angles. |
| Light Silver Foil | #e9e8f0 | --color-light-silver | The light-silver surface for dark ink; use it instead of a flat white fill. |
| Ink | #16151c | --color-foil-ink | Headline and button ink for light foil only; keep it clear of saturated bands. |
| Text | #ececf2 | --color-text | Primary type on the sheet and dark panels, with clear but quiet contrast. |
| Secondary Text | #a9a8b6 | --color-text-secondary | Descriptions and supporting notes recede one step without shrinking to illegibility. |
| Focus Silver | #c9c8d4 | --color-focus-silver | Keyboard focus, range sliders and restrained actions; preserve a visible outline. |
| Sampled Spectral Red | #d2052d | --color-spectrum-red-sample | One red-end sample from the 1500 nm CSS spectrum, used as part of moving light. |
| Sampled Spectral Green | #00d777 | --color-spectrum-green-sample | A computed green sample in the CSS spectrum, never a fixed component fill. |
| Sampled Spectral Violet | #6600e1 | --color-spectrum-violet-sample | A computed violet sample in the CSS spectrum; bands move with the lamp and order. |
| Role | Family | Weight | Size | Line Height | Letter Spacing | Token |
|---|---|---|---|---|---|---|
| display | — | 800 | 72px | 1.05 | -0.025em | --text-display |
| heading-lg | — | 800 | 48px | 1.12 | -0.02em | --text-heading-lg |
| heading | — | 800 | 32px | 1.2 | -0.015em | --text-heading |
| subheading | — | 600 | 24px | 1.3 | — | --text-subheading |
| body-lg | — | 400 | 16px | 1.65 | — | --text-body-lg |
| body | — | 400 | 14px | 1.65 | — | --text-body |
| label | Monospace | 500 | 12px | 1.4 | 0.2em | --text-label |
Base unit: 8px Density: comfortable
| Name | Value | Token |
|---|---|---|
| 4 | 4px | --spacing-4 |
| 8 | 8px | --spacing-8 |
| 12 | 12px | --spacing-12 |
| 16 | 16px | --spacing-16 |
| 24 | 24px | --spacing-24 |
| 32 | 32px | --spacing-32 |
| 40 | 40px | --spacing-40 |
| 48 | 48px | --spacing-48 |
| 64 | 64px | --spacing-64 |
| 96 | 96px | --spacing-96 |
| Element | Value |
|---|---|
| Cards and foil panels | 16px–24px |
| Buttons and input fields | 12px |
| Pills and star seals | 999px |
| Section dividers | 0px; 1px border |
Role: The collector's centerpiece: a wide stamped foil in a quiet dark frame.
Use a #141319 frame, a 10% white hairline and roughly 24px radius around a 1.8:1 foil field. Set the title near the lower edge where the surface is light enough for ink; print notes and serial numbers in secondary grey or monospace. Shadow may sit below the frame, never muddy the foil.
Role: A primary action printed on light foil; pressing bends the material without shifting layout.
Layer a light silver base with a screen highlight and the spectrum in overlay mode. Set dark #16151c ink at 14px/600, 12px radius, 44px minimum height and about 24px horizontal padding. Keep a fine inset rim and restrained shadow; keyboard focus takes a 2px #c9c8d4 outline with offset.
Role: Let readers see how incident angle and groove period change diffraction orders.
Place two horizontal range controls in a dark panel: lamp angle 0°–70° and groove period 800–2200 nm in 50 nm steps. Show the live value and each diffraction order. The track uses silver #c9c8d4, 14px labels and monospace values.
Role: Compare film, concentric starburst and glitter groove layouts side by side.
Use equal samples with 12px corners on #141319. Film combines crossed gratings, star uses concentric grooves, and glitter uses randomly oriented facets. Brushed grooves and thin-film interference require the WebGL2 pixel shader; link to its live study instead of showing a false flat swatch.
Role: A short collector's code for a card or foil pack.
Use a #141319 fill, 1px white border at 15%, 12px radius and 12px 16px padding. The XXXX-XXXX-XXXX format is uppercase monospace with 0.2em tracking and #6c6b78 placeholder text. Focus shifts the border to #c9c8d4 and keeps its ring visible.
Role: A quiet row along the print sheet, rather than a heavy application bar.
Set it on the near-black ground with a 1px white-at-10% rule below and 24px horizontal padding. The wordmark may carry spectral foil text; ordinary links stay #a9a8b6. Reserve the right side for one compact action, with the reference HTML as a secondary text link on wide screens.
| Level | Name | Value | Purpose |
|---|---|---|---|
| 0 | Print Sheet | #0c0b10 | Near-black page ground supporting the foil. |
| 1 | Raised Panel | #141319 | Content cards use a 10% white hairline. |
| 2 | Dark Silver Foil | linear-gradient(#4f4e59, #a3a2af 28%, #5e5d68 50%, #adacb9 76%, #575661) | Grey metal under a spectrum blended with screen. |
| 2 | Light Silver Foil | linear-gradient(#b4b3bf, #e9e8f0 30%, #bdbcc8 52%, #ecebf2 78%, #b6b5c1) | Light metal uses overlay to preserve ink contrast. |
| 3 | Diffracted Spectrum | 1500 nm grating; orders 1:0.5:0.3 over silver | Computed from lamp angle, never a static RGB fill. |
0 24px 48px -28px rgba(0,0,0,0.9)inset 0 1px 0 rgba(255,255,255,0.6)1px solid rgba(255,255,255,0.1); no broad glowradial highlight within 150px of shared lampShow close crops of real spectral foil, collectibles or packaging while retaining visible metal underneath. Static examples use the precomputed spectral strip, silver base and directional highlight; keep photography grain from obscuring fine grooves. Brushed and pearl effects require their actual WebGL shader preview.
Cap the print-sheet container at 1280px, with 24px mobile and 40px desktop padding. Divide sections with a hairline and 48px mobile / 64px desktop vertical rhythm. Use 1.8:1 for the primary foil card and place it beside two square material studies when space allows; preserve enough breathing room to separate sheet, frame and foil.
QUICK COLOR REFERENCE:
#0c0b10#141319#ececf2#a9a8b6#16151c#c9c8d4#e9e8f0EXAMPLE COMPONENT PROMPTS:
holographic) — Both can look iridescent, but Holographic shifts CSS gradients; Diffraction Foil computes wavelength from groove geometry and lamp angle while retaining silver beneath.
:root {
/* Colors */
--color-print-sheet: #0c0b10;
--color-panel: #141319;
--color-dark-silver: #a3a2af;
--color-light-silver: #e9e8f0;
--color-foil-ink: #16151c;
--color-text: #ececf2;
--color-text-secondary: #a9a8b6;
--color-focus-silver: #c9c8d4;
--color-spectrum-red-sample: #d2052d;
--color-spectrum-green-sample: #00d777;
--color-spectrum-violet-sample: #6600e1;
/* Typography — Font Families */
--font-sans: 'Sans Serif', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-mono: 'Monospace', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
/* Typography — Scale */
--text-display: 72px;
--leading-display: 1.05;
--tracking-display: -0.025em;
--text-heading-lg: 48px;
--leading-heading-lg: 1.12;
--tracking-heading-lg: -0.02em;
--text-heading: 32px;
--leading-heading: 1.2;
--tracking-heading: -0.015em;
--text-subheading: 24px;
--leading-subheading: 1.3;
--text-body-lg: 16px;
--leading-body-lg: 1.65;
--text-body: 14px;
--leading-body: 1.65;
--text-label: 12px;
--leading-label: 1.4;
--tracking-label: 0.2em;
/* Typography — Weights */
--font-weight-regular: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
/* Spacing */
--spacing-unit: 8px;
--spacing-4: 4px;
--spacing-8: 8px;
--spacing-12: 12px;
--spacing-16: 16px;
--spacing-24: 24px;
--spacing-32: 32px;
--spacing-40: 40px;
--spacing-48: 48px;
--spacing-64: 64px;
--spacing-96: 96px;
/* Layout */
--page-max-width: 1280px;
--section-gap: 64px;
--card-padding: 24px;
--element-gap: 16px;
--density: comfortable;
/* Border Radius */
--radius-cards-and-foil-panels: 16px–24px;
--radius-buttons-and-input-fields: 12px;
--radius-pills-and-star-seals: 999px;
--radius-section-dividers: 0px; 1px border;
/* Surfaces */
--surface-print-sheet: #0c0b10;
--surface-raised-panel: #141319;
--surface-dark-silver-foil: linear-gradient(#4f4e59, #a3a2af 28%, #5e5d68 50%, #adacb9 76%, #575661);
--surface-light-silver-foil: linear-gradient(#b4b3bf, #e9e8f0 30%, #bdbcc8 52%, #ecebf2 78%, #b6b5c1);
--surface-diffracted-spectrum: 1500 nm grating; orders 1:0.5:0.3 over silver;
}
Component Templates
Ink on light silver foil with the spectrum overlaid; pressing bends the surface toward the press point.
FAQ
/* Diffraction Foil:CSS 平替。灯的脚本(见复现提示词第 7 条)按灯的方向写入
--k(刻槽法向角度)、--bs/--bp(光谱窗口)、--lx/--ly(灯相对元素的位置);
没有脚本时显示一张静态的银底和默认光谱。 */
:root {
--foil-sheet: #0c0b10;
--foil-ink: #16151c;
--foil-silver: #c9c8d4;
/* 光谱条:t 从 -1.25 到 1.25,按 |t| 处的光栅颜色画(d = 1500nm,1–3 级) */
--spectrum: linear-gradient(90deg, #d2052d 0%, #dc463f 1.25%, #db8c4e 2.5%, #ceb557 3.75%, #abc75b 5%, #43ce5a 6.25%, #00cd57 7.5%, #00bd55 8.75%, #009562 10%, #005e8f 11.25%, #0417be 12.5%, #5504cc 13.75%, #b200cc 15%, #df00a7 16.25%, #eb6573 17.5%, #e8c479 18.75%, #cade7e 20%, #00e37b 21.25%, #00d777 22.5%, #00a09a 23.75%, #0022d8 25%, #6600e1 26.25%, #4200bb 27.5%, #01001e 28.75%, #000000 30%, #0a0301 31.25%, #cc0027 32.5%, #f7968e 33.75%, #e5f0af 35%, #00eca8 36.25%, #003ded 37.5%, #6d00dd 38.75%, #000000 40%, #000000 60%, #6d00dd 61.25%, #003ded 62.5%, #00eca8 63.75%, #e5f0af 65%, #f7968e 66.25%, #cc0027 67.5%, #0a0301 68.75%, #000000 70%, #01001e 71.25%, #4200bb 72.5%, #6600e1 73.75%, #0022d8 75%, #00a09a 76.25%, #00d777 77.5%, #00e37b 78.75%, #cade7e 80%, #e8c479 81.25%, #eb6573 82.5%, #df00a7 83.75%, #b200cc 85%, #5504cc 86.25%, #0417be 87.5%, #005e8f 88.75%, #009562 90%, #00bd55 91.25%, #00cd57 92.5%, #43ce5a 93.75%, #abc75b 95%, #ceb557 96.25%, #db8c4e 97.5%, #dc463f 98.75%, #d2052d 100%);
}
.foil {
--k: 24deg;
isolation: isolate;
overflow: hidden;
background: linear-gradient(calc(var(--k) + 90deg), #4f4e59, #a3a2af 28%, #5e5d68 50%, #adacb9 76%, #575661);
}
.foil.foil-light {
--blend: overlay;
background: linear-gradient(calc(var(--k) + 90deg), #b4b3bf, #e9e8f0 30%, #bdbcc8 52%, #ecebf2 78%, #b6b5c1);
}
.foil::before {
content: "";
position: absolute;
z-index: -1;
left: 50%;
top: 50%;
width: var(--dg, 300%);
height: var(--dg, 300%);
transform: translate(-50%, -50%) rotate(var(--k));
background: var(--spectrum) var(--bp, 0) 0 / var(--bs, 100%) 100% repeat-x;
mix-blend-mode: var(--blend, screen);
opacity: 0.92;
pointer-events: none;
}
.foil::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background: radial-gradient(circle at var(--lx, 70%) var(--ly, 0%), rgb(255 255 255 / 0.55), rgb(255 255 255 / 0) 150px);
mix-blend-mode: screen;
pointer-events: none;
}
.foil-text {
background:
radial-gradient(circle at var(--lx, 70%) var(--ly, 0%), rgb(255 255 255 / 0.9), rgb(255 255 255 / 0) 120px),
var(--spectrum) var(--bp, 0) 0 / var(--bs, 100%) 100% repeat-x,
linear-gradient(#e2e1ea, #8f8e9b 55%, #cfced9);
background-blend-mode: screen, screen, normal;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
@media (prefers-reduced-motion: reduce) {
.foil, .foil-text { transition: none; }
}Related Styles
Explore these styles for ready-made tokens and components.
Diffraction Foil and Broadcast Glitch sit closest to each other. The table below gives the real differences in color, use case, and tags, so the choice between them is made on facts.
| Attribute | Diffraction Foil | Broadcast Glitch |
|---|---|---|
| Primary color | #0c0b10 | #0B0B0E |
| Secondary color | #c9c8d4 | #EDEDED |
| Best for | diffraction grating / holographic foil / hot stamping | broadcast glitch / glitch art / CRT |
| Unique tags | colorful | retro |
Export tools
7 style files, including SKILL.md.
Metadata
Style metadata including version information
Design Tokens
Compatible with Figma / Style Dictionary / Tokens Studio
Tailwind Preset
Tailwind CSS theme preset, import directly in config
Global CSS
CSS variables and base styles
shadcn Theme
shadcn/ui theme configuration
CSS Variables
Pure CSS variables, works with any project
SKILL.md
Loadable skill pack for Cursor / Claude Code / VS Code
Diffraction foil is computed, not painted. Grooves 1500 nm apart split light by the grating equation: at small angles the foil is silver, and as the angle grows violet, blue, green, yellow, and red sweep past, then repeat in higher orders.
WCAG 2.1 compliance analysis based on color contrast and typography readability.
Overall Score
Grade: A - Excellent
Contrast Ratios
| Context | Colors | Ratio | AA | AAA |
|---|---|---|---|---|
| Text on background | /#ececf2 / #0c0b10 | 16.66:1 | ||
| Secondary text on background | /#a9a8b6 / #0c0b10 | 8.37:1 | ||
| Muted text on background | /#8a8996 / #0c0b10 | 5.7:1 | ||
| Text on secondary background | /#ececf2 / #141319 | 15.7:1 | ||
| Secondary text on secondary | /#a9a8b6 / #141319 | 7.88:1 | ||
| Button primary | /#16151c / #e3e2ea | 14.1:1 | ||
| Text on accent 1 | /#ececf2 / #1d1c24 | 14.35:1 | ||
| Alt text on accent 1 | /#a9a8b6 / #1d1c24 | 7.21:1 | ||
| Text on accent 2 | /#ececf2 / #26252e | 12.87:1 | ||
| Alt text on accent 2 | /#a9a8b6 / #26252e | 6.46:1 |
Readability
Score
87/100
Font Size
text-sm md:text-base
Font Weight
font-sans font-extrabold tracking-tight
Line Height
default
Scoring is based on WCAG 2.1 standards. AA requires 4.5:1 contrast for normal text, 3:1 for large text; AAA requires 7:1 for normal text, 4.5:1 for large text.