designwithfocus

Color theory & schemes

What Is a Gradient? Color Gradients in Design Explained

By Design With Focus Team 4 min read
Three swatches showing a linear, a radial and a conic color gradient

Short answer

A gradient is a smooth, gradual transition from one color to another. Designers use gradients for backgrounds, buttons, logos and illustrations to add depth and movement. The main types are linear (along a straight line), radial (out from a center) and conic (around a center). In CSS, you create them with functions such as linear-gradient().

Last verified against the sources listed below.

Key takeaways

  • A gradient blends smoothly between two or more colors.
  • Main types: linear, radial and conic.
  • In CSS, gradients are images made with linear-gradient(), radial-gradient() and conic-gradient().
  • Blending in a perceptual color space like OKLCH avoids muddy gray middles.
  • Check text contrast at every point where text sits on a gradient.

Gradients are everywhere in modern design: app icons, hero backgrounds, buttons and brand marks. A good gradient adds depth and energy without a single photo. A bad one looks muddy or striped.

Quick facts
What it is A smooth blend between colors
Main types Linear, radial, conic (plus mesh)
CSS functions linear-gradient(), radial-gradient(), conic-gradient()
Common problems Muddy middles, banding, poor text contrast
Fix for muddy middles Extra color stop or OKLCH blending

A gradient blends one color into another

A gradient is a gradual, smooth change from one color to another. Wikipedia’s color gradient article describes it as a range of position-dependent colors, often used to fill an area.

Each color you specify is called a color stop. A gradient can have just two stops or many, and each stop can sit at a chosen position.

The main types of gradients

The shape of the blend defines the gradient type.

Type How it blends Good for
Linear Along a straight line, at any angle Backgrounds, buttons, banners
Radial Outward from a center point Spotlights, glows, depth
Conic Around a center, like a clock Pie charts, color wheels
Mesh Between many free points Organic, painterly backgrounds

Gradients in CSS

In CSS, gradients are a type of image you set as a background. MDN’s linear-gradient() reference explains that the function creates an image made of a progressive transition between two or more colors along a straight line.

A simple example: background-image: linear-gradient(90deg, #1B7F80, #FFD84D);. That runs from teal on the left to yellow on the right.

MDN’s guide to using CSS gradients covers adding more stops, setting positions, hard color stops for stripes, and repeating gradients. The functions are defined in the W3C CSS Images Module.

The free Gradient Generator builds linear, radial and conic gradients visually and gives you the CSS to copy.

Avoiding muddy middles

Blending opposite hues in standard sRGB can pass through a dull gray. A blue-to-yellow gradient is a classic example: the middle often turns grayish.

Two fixes work well:

  • Add a middle stop with a bright in-between color, such as teal or green.
  • Blend in a perceptual color space. Chrome’s high definition CSS color guide shows how modern CSS can interpolate gradients in spaces like OKLCH, for example linear-gradient(in oklch, blue, yellow), which keeps the middle vivid.

Avoiding banding

Banding shows up as visible stripes in what should be a smooth blend. It is most common in long, subtle gradients and heavily compressed images.

To reduce it, increase the color difference slightly, avoid saving gradients as low-quality JPGs, and add a very light noise or grain texture. Grain breaks up the steps so the eye sees a smooth blend.

Text on gradients

Text over a gradient must stay readable across the whole blend. The contrast between text and background changes from one end to the other.

Check the contrast at the lightest and darkest points behind the text, not just one spot. The Color Contrast Checker gives the ratio for each pair. If one end fails, darken that end, add a subtle overlay, or move the text.

Gradient design tips

The best gradients feel intentional and restrained.

  • Use neighboring hues on the color wheel, such as blue to purple, for smooth, natural blends.
  • Limit stops to two or three for most UI work.
  • Keep brand colors recognizable at the ends of the gradient.
  • Match direction to layout: diagonal gradients add movement, vertical ones feel calm.
  • Test on both light and dark modes if your interface supports them.

Used well, a single gradient can give a flat layout depth and personality with almost no extra file weight.

Gradients also work well in illustrations and charts, where a light-to-dark ramp of one hue can show quantity at a glance. Keep such ramps evenly spaced so each step reads as a clear change.

Frequently asked questions

What is a gradient in design?

In design, a gradient is a gradual blend between colors, such as blue fading into purple. It can be subtle, adding gentle depth to a background, or bold, becoming the main visual feature. Gradients appear in web backgrounds, app icons, logos and illustrations.

What are the types of gradients?

The three main types are linear gradients, which change along a straight line, radial gradients, which spread out from a center point, and conic gradients, which sweep around a center like a color wheel. Mesh gradients blend several points freely and are popular in illustration.

How do you make a gradient in CSS?

Use a gradient function as a background image, for example background-image: linear-gradient(90deg, #1B7F80, #FFD84D). You can add more color stops, set positions with percentages, and use radial-gradient() or conic-gradient() for other shapes.

Why does my gradient look gray in the middle?

Gradients between very different hues, such as blue and yellow, can pass through a dull gray when blended in standard sRGB. Adding a middle color stop or blending in a perceptual space such as OKLCH keeps the middle bright and clean.

What is gradient banding?

Banding is when a smooth gradient shows visible steps or stripes instead of a smooth blend. It happens when there are not enough color steps, often in long, subtle gradients or heavily compressed images. Adding a little noise or grain helps hide it.

Sources