Rainbow gradients

A rainbow gradient runs through the spectrum, from red and orange through yellow and green to blue and violet. Full-strength rainbows are bold and playful, perfect for Pride designs, celebrations, kids' brands and attention-grabbing banners, while pastel rainbows feel soft and dreamy. Because a rainbow passes through both light colors like yellow and darker ones like blue or violet, it's very hard for any single text color to stay readable across the whole gradient, so treat rainbows as decoration and put text on a solid panel above them. Each gradient below shows its CSS and its worst-case text contrast, so you can see the trade-off. Open any of them in the gradient generator to tweak the stops.

6 rainbow gradients with CSS code

  • Full Spectrum

    background: linear-gradient(90deg, #FF0000 0%, #FF8000 25%, #FFFF00 50%, #00C853 75%, #2962FF 100%);

    Black text AA large text only, at worst 4.28:1.

  • Pastel Rainbow

    background: linear-gradient(90deg, #FFB7C5 0%, #FED8B1 25%, #FDFD96 50%, #ACE1AF 75%, #B0E0E6 100%);

    Black text passes AA, at worst 12.83:1.

  • Neon Arc

    background: linear-gradient(120deg, #FF0A4A 0%, #FF5F1F 25%, #CFFF04 50%, #00FFFF 75%, #BC13FE 100%);

    Black text AA large text only, at worst 4.47:1.

  • Soft Prism

    background: linear-gradient(135deg, #F9A8D4 0%, #FDE68A 33%, #A7F3D0 67%, #A5B4FC 100%);

    Black text passes AA, at worst 10.53:1.

  • Retro Stripe

    background: linear-gradient(180deg, #E4502A 0%, #F5A623 25%, #F7C600 50%, #2E8B3A 75%, #1D4E9E 100%);

    Black text fails AA somewhere, at worst 2.63:1.

  • Twilight Rainbow

    background: linear-gradient(90deg, #FF6F7D 0%, #FFB347 33%, #7FDBFF 67%, #6B3FA0 100%);

    Black text fails AA somewhere, at worst 2.84:1.