A header gradient that almost matches the logo is worse than one that makes no attempt. The eye reads the logo and the band behind the page title as one statement, and when the gradient's blue sits a few shades off the logo's blue, the header looks like a printing error. The fix is not a better eye for color. It is using the exact numbers the logo already has.

This guide builds a header gradient the disciplined way: take the logo's two brand colors from the brand sheet, set them as the first and last stops in the free CSS Gradient Generator on Ovatly, pick an angle for a wide, short band, and touch the middle only if it misbehaves. The generator runs in your browser and outputs one background declaration for your stylesheet.

Contents

  • Quick answer
  • Why matching is a numbers job, not an eyeball job
  • What the generator gives you
  • Choosing an angle for a header band
  • When a middle stop earns its place
  • How to build the header gradient, step by step
  • Worked example: a two-stop header in brand blues
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

Note the two hex values your logo uses, from your brand sheet. Open the CSS Gradient Generator, choose a linear gradient, and set the first stop to the first brand hex at 0 percent and the last stop to the second brand hex at 100 percent. For a header, use 90 degrees for a left-to-right blend or a shallow diagonal such as 135 degrees. Add one middle stop only if the blend turns muddy between the two colors. Copy the single background declaration into your header's CSS. The generator has no eyedropper, so the match comes from your known hex values, not from sampling the logo.

Why matching is a numbers job, not an eyeball job

Every logo from a designer or a brand kit has exact hex values behind it, written down in a brand sheet or buried in the logo file's source. Those numbers are the brand. Colors picked off a screenshot will always drift: screenshots get compressed, screens render differently, and color memory is unreliable.

So the rule is simple: never guess a hex value. Without the brand sheet, get the values from whoever made the logo, or read them from the logo's vector source. With the two numbers in hand, the rest is mechanical: the gradient cannot help but match, because its ends are the logo's own colors.

What the generator gives you

The generator builds three kinds of gradient: linear, radial and conic. A header band almost always wants linear. You set its angle, then add color stops: each stop is a hex value at a position, up to six in total. Stops are sorted by position automatically.

Two behaviors matter. First, two stops at exactly the same position do not blend: they make a hard edge, a jump from one color to the next. Second, the preview is live CSS, not a picture: what you ship is the single background declaration it writes.

Choosing an angle for a header band

A header is a wide, short strip, and the angle decides how the blend spends that width: 180 degrees runs top to bottom, 90 degrees left to right, 0 degrees bottom to top.

For a band, 90 degrees spreads the blend across the page's width, beside the title, not behind it. A shallow diagonal such as 135 degrees does the same with a little movement, from one corner to the opposite. Top-to-bottom angles compress the blend into the band's short height, making it abrupt and putting a different color behind the title text.

When a middle stop earns its place

Two brand colors do not always blend cleanly: some pairs pass through a greyish, muddy patch in the middle, where the straight path dips through dull territory.

That is the one case for a middle stop: place a third color near the middle, chosen to keep the blend alive, so the gradient travels brand color to midpoint to brand color. Keep it to one: each extra stop is another decision to defend. If the two-stop blend is clean, ship the two-stop blend.

How to build the header gradient, step by step

  1. Get the logo's two hex values from the brand sheet, exactly; do not sample them from a rendered image.
  2. Open the CSS Gradient Generator and choose the linear type.
  3. Set the angle: 90 degrees for a straight left-to-right blend, or a shallow diagonal such as 135 degrees.
  4. Set the first stop to the first brand hex at 0 percent and the last stop to the second brand hex at 100 percent.
  5. Check the preview at header proportions, wide and short. If the middle looks muddy, add one middle stop and adjust its position until the blend stays clean.
  6. Copy the background declaration into your header's CSS rule, then check the real page with the real logo on the band.

Worked example: a two-stop header in brand blues

Say the brand sheet lists a sky blue, #0ea5e9, and a deeper blue, #2563eb. In the generator, that is a linear gradient at 135 degrees, with #0ea5e9 at 0 percent and #2563eb at 100 percent, the exact example the tool itself demonstrates. The output is one declaration:

background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);

Read as a header, the band opens in the lighter sky blue at the top left, where a logo usually sits, and settles into the deeper blue at the bottom right. Because the first stop is the logo's own lighter blue, logo and band agree at the corner where they meet, where a mismatch would shout loudest. No middle stop is needed here: the path between these two blues stays clean, so the two-stop version is the finished design.

Limitations and honest tradeoffs

The generator's stops are hex values only. There are no rgba stops and no transparent stops, so no gradient from it fades into the page background; every pixel of the band is a solid blend of your colors. A fade to transparent has to be written by hand outside the tool.

There is no eyedropper, no sampler, and the tool never opens an image. That is a deliberate honesty point, not a missing feature to work around: the match is only as good as the hex values you bring. Type in a guess and you get a precisely rendered guess. The six-stop ceiling is the last limit: generous for a header, but a complex multi-band gradient belongs in hand-written CSS.

Common mistakes

  • Sampling colors from a screenshot of the logo. Compression and screen rendering shift the values. Use the brand sheet numbers.
  • Running the blend top to bottom in a short band. The color change is crushed into the band's height and fights the title text. Work along the width instead.
  • Adding stops to fix a muddy middle before checking the angle. Sometimes the mud is the angle's fault. Change the direction first; add a stop only if the mud survives.
  • Judging the preview as a full-page rectangle. A gradient balanced in a tall preview box behaves differently in a short band. Preview at header proportions.

FAQs

Can the gradient generator sample colors from my logo image? No. The generator has no eyedropper or sampler and never opens your logo file. Matching works because you type the logo's known hex values from your brand sheet in as the first and last stops.

How many color stops can a gradient have? Up to six. Each stop is a hex value at a position, and stops are sorted by position automatically. Two stops at exactly the same position create a hard edge instead of a blend.

Which angle suits a header band? A left-to-right run at 90 degrees, or a shallow diagonal such as 135 degrees: both spread the blend across the width of a wide, short band without stacking colors behind the title. For reference, 180 degrees runs top to bottom and 0 degrees runs bottom to top.

Can I fade the gradient out to transparent at the bottom? Not with this generator. Its stops are hex values only, with no rgba or transparent stops, so the whole output is a solid blend of your colors. A fade to transparent has to be written by hand in your own CSS.

Is the preview an image I can download? No. The preview is live CSS rendered by your browser; the output is a single background declaration for your stylesheet. Nothing is uploaded: the generator runs entirely on your device.

Conclusion

A gradient header matches a logo when nobody judged a color by eye: the logo's two hex values become the first and last stops, the angle runs along the band's width, and a middle stop appears only when the blend earns it. The generator handles the syntax and the preview; your brand sheet supplies the truth. Once the header is sorted, the same discipline applies to its icons, as the companion guide on debugging a favicon that shows on desktop but not on mobile shows. For more guides in this series, see our Website and Webmaster Tools guides.

References