RSS FeedTwitterMastodonBlueskyShare IconHeart IconGithub IconArrow IconClock IconGUI Challenges IconHome IconNote IconBlog IconCSS IconJS IconHTML IconShows IconOpen Source Software IconSpeaking IconTools IconShuffle IconNext IconPrevious IconCalendar IconCalendar Edit IconNotebook IconObservable Notebooks IconSlash IconGoogle G Icon
A cartoon skull with a hotpink hat on.
atom@argyleink
notecss

CSS color tip!

Need a rainbow gradient? Let <hue-interpolation> do the work.

.vibrant-rainbow {
  background: linear-gradient(
    to right 
    in hsl      /* vibrant gradient HSL colorspace */
    longer hue, /* hue-interpolation set to longer */
    red, red    /* now red to red goes all the way around */
  );
}
All colors of the rainbow in a gradient from left to right.

10 comments #

101likes
22reposts
  • T. Afif @ CSS Challenges
  • Ana Tudor 🐯🖤🌻
  • Peter Pan
  • Ramsés :prami_pride_rainbow:
  • Benny Powers 🇨🇦️🇮🇱️
  • Elly Loel ✨🌱
  • Matt Wing
  • patak
  • Oliver
  • Myles
  • Tim
  • Ofelquis Gimenes
  • 🔥.codes
  • Lady Murphy
  • Juan Adrián
  • Sujal Shah ⚡
  • Chromium Developers
  • Tigran 🇦🇲
  • chotus magnificus
  • Alex Lam
  • Konstantin Dankov
  • Christa Dickson

Join the conversation on

When you think you know everything about gradients and then .... 👀👀 It's time for some Spec reading.
T. Afif @ CSS ChallengesT. Afif @ CSS Challenges
It means you can also do the following ``` background: linear-gradient(to right in hsl longer hue, red 0 0) ``` And it works! One color declaration to generate a full rainbow gradient 😲
T. Afif @ CSS ChallengesT. Afif @ CSS Challenges
What am I missing? Is it from a specific version? I just see a red box. 😓 If i put a second color, i see the rainbow correctly, but with both reds it's a plain colored box ☹️
Álvaro MontoroÁlvaro Montoro
I'm on Safari. I'll try Canary and TP later.
Álvaro MontoroÁlvaro Montoro
💡 CSS Tip! Create an infinite rainbow gradient animation 🌈 Demo: codepen.io/t_afif/pen/qBy… via @CodePen ✅ One color declaration ✅ A simple animation Powered by the new color interpolations 👇 #CSS
T. Afif @ CSS ChallengesT. Afif @ CSS Challenges
💡 CSS Tip! Create an infinite rainbow gradient animation 🌈 Demo: codepen.io/t_afif/pen/qBy… via @CodePen ✅ One color declaration ✅ A simple animation Powered by the new color interpolations 👇 #CSS
T. Afif @ CSS ChallengesT. Afif @ CSS Challenges
This is also going to solve the old problem of passing through the dead zone (css-tricks.com/the-gray-dead-…) on the axis of the HSL bicone (codepen.io/thebabydino/fu…).
Ana Tudor 🐯🖤🌻Ana Tudor 🐯🖤🌻