Each letter hops and shifts to its own hue on hover, fanning the accent out into a spectrum. A hue-rotate() filter scaled by the letter index does it, so any accent color works.
Also known as: rainbow text on hover, colorful letters hover, hue shift text.
<div class="hfx-text-rainbow-letters" aria-label="Rainbow"><span style="--i: 0">R</span><span style="--i: 1">a</span><span style="--i: 2">i</span><span style="--i: 3">n</span><span style="--i: 4">b</span><span style="--i: 5">o</span><span style="--i: 6">w</span></div>
.hfx-text-rainbow-letters {
--c: var(--hfx-color, #3b82f6);
font-size: calc(var(--hfx-size, 16px) * 2.5);
font-family: system-ui, sans-serif;
font-weight: 800;
line-height: 1.15;
cursor: default;
display: inline-flex;
color: var(--c);}
.hfx-text-rainbow-letters span {
display: block;
transition: filter 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
transition-delay: calc(var(--i) * 0.04s);
}
.hfx-text-rainbow-letters:hover span {
filter: hue-rotate(calc(var(--i) * 48deg));
transform: translateY(-0.1em);
}
@media (prefers-reduced-motion: reduce) {
.hfx-text-rainbow-letters, .hfx-text-rainbow-letters *, .hfx-text-rainbow-letters::before, .hfx-text-rainbow-letters::after, .hfx-text-rainbow-letters *::before, .hfx-text-rainbow-letters *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.