StyleKit

Diffraction Foil

镭射箔

A
93/100Excellent
Rate this style

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.

diffraction gratingholographic foilhot stampingtrading cardanti-counterfeitWebGL shaderspectral colorpointer lightiridescent foil

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

Diffraction Foil as a design document

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.

Diffraction Foil — Style Reference

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.

Colors

NameValueTokenRole
Print Sheet#0c0b10--color-print-sheetThe near-black page ground, keeping the changing silver foil and spectrum in focus.
Panel#141319--color-panelDark card and container fill, separated by a faint white hairline.
Dark Silver Foil#a3a2af--color-dark-silverThe silver-grey base for dark foil; iridescence overlays it only at matching angles.
Light Silver Foil#e9e8f0--color-light-silverThe light-silver surface for dark ink; use it instead of a flat white fill.
Ink#16151c--color-foil-inkHeadline and button ink for light foil only; keep it clear of saturated bands.
Text#ececf2--color-textPrimary type on the sheet and dark panels, with clear but quiet contrast.
Secondary Text#a9a8b6--color-text-secondaryDescriptions and supporting notes recede one step without shrinking to illegibility.
Focus Silver#c9c8d4--color-focus-silverKeyboard focus, range sliders and restrained actions; preserve a visible outline.
Sampled Spectral Red#d2052d--color-spectrum-red-sampleOne red-end sample from the 1500 nm CSS spectrum, used as part of moving light.
Sampled Spectral Green#00d777--color-spectrum-green-sampleA computed green sample in the CSS spectrum, never a fixed component fill.
Sampled Spectral Violet#6600e1--color-spectrum-violet-sampleA computed violet sample in the CSS spectrum; bands move with the lamp and order.

Typography

Sans Serif — Use the site sans face: heavy, tight display type and monospace labels with tracking; add no new font dependency.
  • Substitute: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif
  • Weights: 400, 500, 600, 700, 800
  • Sizes: 12, 14, 16, 20, 24, 32, 48, 72
  • Line height: 1.05 (display), 1.2 (headings), 1.65 (body)
  • Letter spacing: -0.025em on display, 0.2em on uppercase labels
Monospace — For the grating equation, nanometre values, redeem codes and sparse technical labels, never long-form copy.
  • Substitute: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace
  • Weights: 400, 500, 600
  • Sizes: 12, 14, 16, 18
  • Line height: 1.2 (display), 1.4 (headings), 1.65 (body)
  • Letter spacing: 0.04em on display, 0.2em on uppercase labels
Type Scale
RoleFamilyWeightSizeLine HeightLetter SpacingToken
display—80072px1.05-0.025em--text-display
heading-lg—80048px1.12-0.02em--text-heading-lg
heading—80032px1.2-0.015em--text-heading
subheading—60024px1.3—--text-subheading
body-lg—40016px1.65—--text-body-lg
body—40014px1.65—--text-body
labelMonospace50012px1.40.2em--text-label

Spacing & Layout

Base unit: 8px Density: comfortable

Spacing Scale
NameValueToken
44px--spacing-4
88px--spacing-8
1212px--spacing-12
1616px--spacing-16
2424px--spacing-24
3232px--spacing-32
4040px--spacing-40
4848px--spacing-48
6464px--spacing-64
9696px--spacing-96
Border Radius
ElementValue
Cards and foil panels16px–24px
Buttons and input fields12px
Pills and star seals999px
Section dividers0px; 1px border
  • Page max-width: 1280px
  • Section gap: 64px
  • Card padding: 24px
  • Element gap: 16px

Components

Foil Trading Card

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.

  • Sizes: foil face 1.8:1; frame padding 20px–24px
  • States: spectrum follows the shared lamp; non-foil card frame remains still
Light Foil Button

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.

  • Sizes: minimum height 44px; 12px radius
  • States: press: bend shading normal up to 14° and spring back; never translate the button
Grating Controls

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.

  • Sizes: panel padding 24px–32px; two 44px-high controls
  • States: changing angle or period updates computed wavelength markers and spectral strip
Foil Material Samples

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.

Redeem-Code Field

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.

  • Sizes: 14px monospace; 12px 16px padding; 12px radius
  • States: input uppercases characters and announces incomplete/valid format; validation does not depend on color alone
Collector Navigation

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.

  • Sizes: roughly 56px high; 24px horizontal padding
  • States: hover raises text contrast; keyboard links keep the silver offset outline

Do's and Don'ts

Do
  • Compute wavelength with λ = d × |dot(h, k)| / m, using 1500 nm for d and order weights 1, 0.5 and 0.3.
  • Use one shared pointer lamp 300px above the screen; color follows relative angle and bare silver shows between orders.
  • Treat violet, blue, green, yellow and red as a computed moving spectrum, not a fixed palette.
  • Share one WebGL2 context across the interactive page; render each material and copy it to the element canvas.
  • Keep a CSS fallback that follows the same lamp when WebGL is unavailable or disabled.
  • Put interaction on the shading normal: tilt at most 14°, with stiffness 320 and damping ratio 0.32.
  • Reserve dark ink for light silver; set sheet copy in #ececf2 and supporting text in #a9a8b6.
  • Honor reduced-motion preferences by parking the lamp and disabling orbit and spring overshoot.
Don't
  • Do not fake diffraction with a static iridescent gradient or animated background-position.
  • Do not flood the foil with rainbow; most of each surface must still read as silver.
  • Do not set ink on saturated bands; move the text over a light-silver area instead.
  • Do not open one WebGL context per element or repeatedly run expensive independent shaders.
  • Do not cycle hue-rotate; it breaks the material's explainable relationship to grooves and light.
  • Do not invent a flat CSS swatch for WebGL-only brushed or pearl materials.
  • Do not interleave layout reads with style writes; measure first, then render or write variables.
  • Do not keep orbit, bounce or spring overshoot under reduced-motion settings.

Surfaces

LevelNameValuePurpose
0Print Sheet#0c0b10Near-black page ground supporting the foil.
1Raised Panel#141319Content cards use a 10% white hairline.
2Dark Silver Foillinear-gradient(#4f4e59, #a3a2af 28%, #5e5d68 50%, #adacb9 76%, #575661)Grey metal under a spectrum blended with screen.
2Light Silver Foillinear-gradient(#b4b3bf, #e9e8f0 30%, #bdbcc8 52%, #ecebf2 78%, #b6b5c1)Light metal uses overlay to preserve ink contrast.
3Diffracted Spectrum1500 nm grating; orders 1:0.5:0.3 over silverComputed from lamp angle, never a static RGB fill.

Elevation

  • Trading card: 0 24px 48px -28px rgba(0,0,0,0.9)
  • Light-foil top rim: inset 0 1px 0 rgba(255,255,255,0.6)
  • Dark panel: 1px solid rgba(255,255,255,0.1); no broad glow
  • Lamp highlight: radial highlight within 150px of shared lamp

Imagery

Show 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.

Layout

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.

Agent Prompt Guide

QUICK COLOR REFERENCE:

  • background: #0c0b10
  • panel: #141319
  • text: #ececf2
  • secondaryText: #a9a8b6
  • inkOnLightFoil: #16151c
  • silver: #c9c8d4
  • brightSilver: #e9e8f0

EXAMPLE COMPONENT PROMPTS:

  1. Build an interactive hot-stamped collector card on #0c0b10. Frame it in #141319 with a 10% white hairline and a 1.8:1 silver foil field. Compute wavelength with λ = d × |dot(h, k)| / m, d = 1500 nm, and order weights 1/0.5/0.3. One shared pointer lamp 300px above the screen drives the whole page; most of each surface must remain silver. Use overlay on light foil and screen on dark foil. Share a single WebGL2 context and provide a CSS fallback driven by the same spectrum strip and lamp; press bends the shading normal without moving the card. Park the lamp for reduced motion. Verify that hue follows lamp angle, silver remains visible, card geometry stays fixed, focus is clear, and the CSS fallback works.

Similar Brands

  • Holographic (holographic) — Both can look iridescent, but Holographic shifts CSS gradients; Diffraction Foil computes wavelength from groove geometry and lamp angle while retaining silver beneath.

Quick Start


: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;
}
Read the setup docsRemote MCP endpoint, no token required

Community

Ratings & Feedback

No ratings yet - be the firstSign in to rate

Loading comments…

Component Templates

Component Preview

Foil button

Ink on light silver foil with the spectrum overlaid; pressing bends the surface toward the press point.

FAQ

Diffraction Foil — Frequently Asked Questions

What is the Diffraction Foil design style?
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. Its core principle: Diffraction foil is computed, not painted.
What colors does Diffraction Foil use?
Diffraction Foil uses #0c0b10 as its primary color and #c9c8d4 as its secondary color, with accent colors #ff5ab8, #ffd36b, #4fe0b4, #5aa8ff. Every hex value can be copied from the palette on this page.
How do I apply Diffraction Foil correctly?
Key practices: 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. Treat the pointer as a lamp 300 px above the screen shared by every foil element; after 4 idle seconds let it orbit slowly. Seat the foil on a bg-[#0c0b10] print sheet with text-[#ececf2] body copy and text-[#a9a8b6] secondary text.
What are common mistakes with Diffraction Foil?
Avoid: Do not fake foil with a fixed rainbow gradient and an animated background-position. Do not open one WebGL context per element. Do not flood the surface with rainbow; most of it should read as silver.
How do I prompt AI to generate Diffraction Foil UI?
Copy the ready-made AI prompt on this page — it bundles the design tokens and component rules — and paste it into ChatGPT, Claude, Claude Code, or Codex. Effective prompts include the keywords: diffraction grating, holographic foil, hot stamping, trading card.
Global Styles

Global CSS

css
/* 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

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.

AttributeDiffraction FoilBroadcast Glitch
Primary color#0c0b10#0B0B0E
Secondary color#c9c8d4#EDEDED
Best fordiffraction grating / holographic foil / hot stampingbroadcast glitch / glitch art / CRT
Unique tagscolorfulretro

Export tools

One click, then paste

View Full Showcase →

7 style files, including SKILL.md.

Preview or download individual files

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

Design Philosophy

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.

Accessibility

Accessibility Score

WCAG 2.1 compliance analysis based on color contrast and typography readability.

93

Overall Score

Grade: A - Excellent

Contrast Ratios

Score: 95/100Average Ratio: 10.93:1
AA PassAAA Fail
ContextColorsRatioAAAAA
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.