HEX to SwiftUI Color
Turn a HEX code into SwiftUI Color, UIColor and NSColor code.
Fill headline text with a gradient, and keep it selectable.
The CSS appears here
The Gradient Text Generator builds the background-clip technique visually, previews it on your own headline, and always emits a solid fallback colour — because transparent text with a failed clip is invisible text.
Gradient text is a small CSS trick with a specific shape: put the gradient on the background, clip the background to the text, and make the text itself transparent so the background shows through. Three declarations, and it works everywhere.
This builds it visually. Set the colours and the angle, type your own headline into the preview, and the CSS updates as you go — including the -webkit-background-clip prefix, which is still required for Safari and is the reason most hand-written attempts fail silently.
The fallback matters more than the effect. If background-clip fails, transparent text on a transparent background is invisible, so the generator always emits a solid colour first and wraps the clipping in a @supports block. It also scores the gradient against your page background at both ends, because gradient text is still text and still has to pass contrast — and a gradient that fades into the background at one end fails it however good it looks.
-webkit-background-clip is still required for Safari, and leaving it out is why most hand-written attempts render nothing.
A solid colour first, with the clipping wrapped in @supports, so a failure degrades to readable text rather than to nothing.
The preview uses your headline at your size, which is the only honest way to judge the effect.
Gradient text is still text. The pale end is scored too, because that is the end that fails.
The text stays real text — searchable, selectable and readable by a screen reader.
Two or more stops, and the angle they run at.
The preview uses your own text at your own size, which is the only honest way to judge it.
The contrast is scored at the lightest and darkest point of the gradient.
With the fallback colour and the prefix already in place.
Almost always the missing -webkit-background-clip: text. Without it the text stays transparent and the background is not clipped, so nothing renders. The generated code includes it.
The text stays real text — selectable, searchable and readable by screen readers — so semantically it is fine. Visually it needs care: score the contrast at both ends, because the pale end is the one that fails.
Yes, by making the background larger than the element and animating background-position. Animating gradient colour stops directly does not interpolate in most browsers.
No. It works because a headline is large and short. Across a paragraph the varying contrast makes reading measurably harder, and the effect stops being noticeable anyway.
What people who use the Gradient Text Generator think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Gradient Text Generator. It takes half a minute and no account.
Write the first reviewTurn a HEX code into SwiftUI Color, UIColor and NSColor code.
Score every colour in a palette against every other one.
Work out the solid colour a translucent layer really produces.
Interpolate an even scale between two or more colours.
Find the closest named colour to any HEX code.
Generate complementary, analogous and triadic palettes from one colour.
Convert LCH to HEX and RGB — LAB in polar form, as CSS uses it.
The RAL Classic chart, searchable, with screen approximations.