CSS Conic Gradient Background

A conic gradient background in pure CSS: navy, teal, green and yellow sweeping around a center point. Move the center, rotate it and pick each color.

#223b8c
#167364
#4b9c41
#f09f33
0deg
50%
50%
.bg-conic-gradient {
  --bg: #223b8c;
  --c1: #167364;
  --c2: #4b9c41;
  --c3: #f09f33;
  --angle: 0deg;
  --x: 50%;
  --y: 50%;
  background-color: var(--bg);
  background-image: conic-gradient(from var(--angle) at var(--x) var(--y), var(--bg), var(--c1), var(--c2), var(--c3), var(--c2), var(--c1), var(--bg));
}
<div class="
  [--bg:#223b8c]
  [--c1:#167364]
  [--c2:#4b9c41]
  [--c3:#f09f33]
  [--angle:0deg]
  [--x:50%]
  [--y:50%]
  [background-color:var(--bg)]
  [background-image:conic-gradient(from_var(--angle)_at_var(--x)_var(--y),_var(--bg),_var(--c1),_var(--c2),_var(--c3),_var(--c2),_var(--c1),_var(--bg))]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Conic Gradient — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-conic-gradient {
      --bg: #223b8c;
      --c1: #167364;
      --c2: #4b9c41;
      --c3: #f09f33;
      --angle: 0deg;
      --x: 50%;
      --y: 50%;
      background-color: var(--bg);
      background-image: conic-gradient(from var(--angle) at var(--x) var(--y), var(--bg), var(--c1), var(--c2), var(--c3), var(--c2), var(--c1), var(--bg));
    }
  </style>
</head>
<body class="bg-conic-gradient"></body>
</html>

Save the pattern as an image, with your current colors and settings.

How this conic gradient works

A conic-gradient() changes color around a center point, like the hand of a clock sweeping a full circle, instead of along a line. Each stop is an angle, and with no angles given CSS spaces them evenly around the 360°.

This one goes navy, teal, green, yellow, then back through green and teal to navy. Mirroring the colors matters. The end of a conic gradient meets its start, so if the last color differs from the first you get a hard seam. Here the sweep starts and ends on --bg, and yellow only ever blends into green.

from var(--angle) rotates the whole sweep, and at var(--x) var(--y) moves the center. Put the center near a corner and the colors fan out across the element like a spotlight.

Conic gradients also make pie charts and color wheels: give each stop a start and end angle for sharp slices.

Use it for hero sections, app splash screens, abstract backgrounds and data-themed designs.

All CSS background gradients →