Skip to content
ChromaBrew
Go Pro
TutorialsBy Opeyemi Olorunfemi

Gradient text that stays readable

A worked tutorial on background-clip text gradients: picking stop pairs with enough darkness, fallback colors, and contrast honesty.

Build it on background-clip

The technique: transparent text color over a background gradient clipped to the glyphs (background-clip: text). It works in all modern browsers and degrades to whatever color you declare — which is exactly where most implementations fail, by declaring nothing and degrading to invisible text.

Always declare the fallback first: a solid color close to the gradient's midpoint. Older browsers and some assistive-technology render paths show the fallback, so it must pass contrast on its own — treat it as a real text color, not a formality.

.gradient-text {\n  color: #6d28d9; /* fallback: must pass on its own */\n  background: linear-gradient(120deg, #7c3aed, #db2777);\n  -webkit-background-clip: text;\n  background-clip: text;\n  -webkit-text-fill-color: transparent;\n  color: transparent;\n}

Keep the dark end honest

Gradient text fails contrast at its lightest stop — a violet-to-pink headline on white passes at the violet end and fails at the pink. The fix is choosing pairs whose lightest stop still clears 3:1 for large display type (gradient text should never be body copy), or deepening the whole pair until it does.

Restrict gradient text to short display strings: hero phrases, section titles, numbers. A paragraph of gradient text is unreadable by design — the eye needs a stable color to track lines.

Mind motion and meaning

Never convey meaning by the gradient alone — 'red items are overdue' fails the moment the gradient shifts hue across words. Pair color with labels, icons, or position, the same rule as any color-coded UI.

Animated gradient text (shifting background-position) is a highlight, not a default: gate it behind prefers-reduced-motion checks and keep one static instance as the baseline experience. Delight that excludes is just exclusion with better kerning.

Tip

Screenshot the headline, blur it slightly, and check the words still separate from the background. The squint test catches gradient-text failures in seconds.

Related free tools

Want to apply this right now? Open the color palette generator and try it with your own brand color — free, no sign-up.