Spinners Animation — Reference

Rainbow

The Rainbow is a CSS animation component that a pure CSS rainbow spinner that uses layered inset box-shadows to create vivid concentric colour bands on a spinning semicircle. No images, no SVG — just CSS. It ships as self-contained HTML and CSS with no external dependencies, making it drop-in ready for any modern web project regardless of framework or build system.

spinnerrainbowloaderbox-shadowcolorful

When to use the Rainbow

Performance characteristics

How it compares

Unlike equivalent JavaScript implementations, the Rainbow does not require any runtime library — there is nothing to install, bundle, or load asynchronously.

Compared to animated GIFs or video embeds, this CSS component is resolution-independent, theme-able via CSS custom properties, and weighs a fraction of the equivalent media file.

Source code

CSS

css
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f0f0f; }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .rainbow {
      border-radius: 100%;
      clip-path: inset(0 0 50% 0);
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100px;
      position: relative;
      width: 100px;
    }
    .rainbow:after {
      content: '';
      height: 10px;
      width: 10px;
      position: absolute;
      border-radius: 100%;
      box-shadow:
        -40px -2px 0 1px #ffffff, -35px -6px 0 1px #ffffff,
        -30px -2px 0 1px #ffffff, -30px -8px 0 1px #ffffff,
        -25px -2px 0 1px #ffffff, -25px -8px 0 1px #ffffff,
        -20px -6px 0 1px #ffffff, -15px -2px 0 1px #ffffff,
         40px -2px 0 1px #ffffff,  35px -6px 0 1px #ffffff,
         30px -2px 0 1px #ffffff,  30px -8px 0 1px #ffffff,
         25px -2px 0 1px #ffffff,  25px -8px 0 1px #ffffff,
         20px -6px 0 1px #ffffff,  15px -2px 0 1px #ffffff;
    }
    .rainbow:before {
      content: '';
      height: 80px;
      width: 80px;
      animation: spin 1.5s linear infinite;
      border-radius: 100%;
      box-shadow:
        0 0 0 4px  #f22613 inset,
        0 0 0 8px  #f89406 inset,
        0 0 0 12px #f9bf3b inset,
        0 0 0 16px #2ecc71 inset,
        0 0 0 20px #19b5fe inset,
        0 0 0 24px #663399 inset,
        0 0 0 28px #bf55ec inset;
      clip-path: inset(0 0 50% 0);
      position: absolute;
    }

HTML

html
<div class="rainbow"></div>

Full source

html
<!DOCTYPE html>
<html>
<head>
  <style>
    body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f0f0f; }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .rainbow {
      border-radius: 100%;
      clip-path: inset(0 0 50% 0);
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100px;
      position: relative;
      width: 100px;
    }
    .rainbow:after {
      content: '';
      height: 10px;
      width: 10px;
      position: absolute;
      border-radius: 100%;
      box-shadow:
        -40px -2px 0 1px #ffffff, -35px -6px 0 1px #ffffff,
        -30px -2px 0 1px #ffffff, -30px -8px 0 1px #ffffff,
        -25px -2px 0 1px #ffffff, -25px -8px 0 1px #ffffff,
        -20px -6px 0 1px #ffffff, -15px -2px 0 1px #ffffff,
         40px -2px 0 1px #ffffff,  35px -6px 0 1px #ffffff,
         30px -2px 0 1px #ffffff,  30px -8px 0 1px #ffffff,
         25px -2px 0 1px #ffffff,  25px -8px 0 1px #ffffff,
         20px -6px 0 1px #ffffff,  15px -2px 0 1px #ffffff;
    }
    .rainbow:before {
      content: '';
      height: 80px;
      width: 80px;
      animation: spin 1.5s linear infinite;
      border-radius: 100%;
      box-shadow:
        0 0 0 4px  #f22613 inset,
        0 0 0 8px  #f89406 inset,
        0 0 0 12px #f9bf3b inset,
        0 0 0 16px #2ecc71 inset,
        0 0 0 20px #19b5fe inset,
        0 0 0 24px #663399 inset,
        0 0 0 28px #bf55ec inset;
      clip-path: inset(0 0 50% 0);
      position: absolute;
    }
  </style>
</head>
<body>
  <div class="rainbow"></div>
</body>
</html>

Frequently asked questions

How do I add the Rainbow to my project?

Copy the full source code from the code block on this page. Paste the <style> block into your stylesheet (or a <style> tag in your HTML head) and the HTML markup into your template. No npm install or build step is required — the animation is self-contained. To customize colors, speed, or size, use Grepped's workspace at grepped.dev/animations/spinners/rainbow-spinner.

Is the Rainbow free to use?

Yes. All Grepped preset animations are free to use in personal and commercial projects. You may copy, modify, and redistribute the code without attribution. The only limitation is that you may not resell the presets themselves as part of a competing animation library.

Does the Rainbow work on mobile browsers?

Yes. The Rainbow uses standard CSS animations and transforms that are supported in all modern mobile browsers — Chrome for Android, Safari on iOS 9+, Samsung Internet, and Firefox for Android. Where JavaScript is used for interactivity (e.g. cursor effects), it falls back gracefully on touch devices.

Can I customize the Rainbow's colors, speed, or size?

Yes. Open the live customization workspace at grepped.dev/animations/spinners/rainbow-spinner to adjust the animation with real-time sliders, color pickers, and toggles — no code required. For deeper changes, the source code uses CSS custom properties (variables) so you can edit them directly in your stylesheet.

Want to customize this animation or generate a new one from a text prompt?

Open in Workspace — it's free