Iridescent Foil Sweep
Hot-foil type that shifts colour under the pointer — Newton's series rather than a rainbow, translated rather than rotated.
- Category
- Text Effects
- Added
- 2026-09-21
- Deps
- none
- Updated
- 2026-09-21
This is a viberdy Pro component
The live preview, the props panel and the write-up are open to everyone. The full source, the AI prompt and CLI install are part of Pro.
Props
"use client";
import type { ReactNode } from "react";
import { useRef } from "react";
/**
* Hot-foil type that shifts colour as the pointer moves across it.
*
* FOIL IS NOT A RAINBOW. A hue-rotate sweep, or an evenly spaced spectral
* gradient, reads as a Pride flag rather than as metal — it is the single
* reason most "holographic" treatments look cheap. Thin-film interference
* produces Newton's series: silver, champagne, magenta, cyan, green, gold,
* violet, and back to silver — UNEVENLY spaced, never saturated to the corner
* of the gamut, and always returning to a neutral. The stop list below is that
* series, and the uneven positions are the whole effect.
*
* THE COLOUR SHIFTS, THE GRADIENT DOES NOT ROTATE. Real foil changes hue with
* the ANGLE between the surface and your eye, which on a screen maps to where
// ---------------------------------------------------------------
// Full source available with a viberdy Pro subscription.
// https://viberdy.dev/pricing
// ---------------------------------------------------------------
}About this text effect
Almost every holographic or foil treatment on the web is a hue-rotate sweep or an evenly spaced spectral gradient, and both read as a rainbow rather than as metal. Real foil gets its colour from thin-film interference, which produces Newton's series — silver, champagne, magenta, cyan, green, gold, violet, back to silver — and three properties of that series are what sell it: the stops are unevenly spaced, none of the colours is saturated to the corner of the gamut, and the sequence returns to a neutral at both ends. Reproducing those turns a gradient into a material. The second decision is how the colour moves. Foil shifts hue with the angle between the surface and the eye, which on screen maps to where the pointer is, and that is a translation along a fixed gradient rather than a rotation of it: an oversized background whose position slides. Rotating the gradient instead swings the entire sheet like a compass needle, which no physical surface does, and it is the giveaway in most implementations that animate an angle. The pointer position is written as custom properties directly on the element rather than through state, because routing a value that changes on every pointer move through React re-renders the subtree sixty times a second to alter one number. The treatment is clipped to the glyphs, and it only reads as foil against a matte dark ground — on a light or busy background it is just a gradient.
Curator’s note
Evenly spaced spectral stops are what make a holographic treatment look cheap. Newton's series is uneven, unsaturated, and returns to silver at both ends.
Pairs well with
Matched on shared tags and category — the entries most likely to be used alongside this one.
Specular Text Sweep
text effectsA light band travelling inside the glyphs, clipped to the text so only ink lights up.
Typewriter Text
text effectsText that types itself out character by character, then cycles to the next phrase.
Aurora Gradient Field
backgroundsSoft, hue-shifting color fields that drift behind a hero like ambient aurora light.