colour cycle

Colour Cycle Explained: Create Mesmerizing Color Transitions in Minutes

By Steven Jackson
AD

A colour cycle is what happens when a set of colours rotates through a fixed sequence, over and over, until the loop closes and begins again. You have almost certainly seen one today: the shimmering water in a retro adventure game, the animated gradient behind a modern app's login screen, and the pulsing glow on a smart speaker all rely on the same underlying idea. At its heart, a colour cycle is a deceptively simple mechanism with an unusually wide reach.

Understanding colour cycles matters whether you are a pixel artist trying to fake flowing lava with three shades of orange, a front-end developer animating a CSS gradient without wrecking performance, or a designer building a brand palette that shifts with the seasons. The technique sits at the crossroads of colour theory, perception science, and practical engineering, and each of those disciplines changes how the cycle should be built.

What Exactly Is a Colour Cycle?

In the strictest technical sense, a colour cycle is an animation technique in which the colours assigned to a piece of artwork are shifted one position along a predefined sequence, frame by frame. Nothing in the artwork itself moves. Instead, pixels that were dark blue become mid blue, mid blue becomes light blue, and light blue wraps back around to dark blue. The result is the illusion of motion along the path those colours describe.

AD
a color wheel with different colors in it
a color wheel with different colors in it
a color wheel with the words color theory written in different languages and colors on it
a color wheel with the words color theory written in different languages and colors on it
k
k

This approach was born out of necessity. Early computer graphics had tight limits on memory and processor speed, and redrawing complex shapes every frame was expensive. Swapping palette entries was cheap. Change a few values in a hardware colour table and an entire waterfall, lava flow, or force field animates instantly, with zero additional artwork and almost no CPU cost. That economy is the reason the technique survived well beyond the hardware that inspired it.

Colour Cycling in Classic Games and Pixel Art

Indexed colour graphics made colour cycling almost free. Instead of storing a full red-green-blue value for every pixel, an image stored a single number pointing to a slot in a palette of 256 entries. Hardware looked up that slot when drawing each pixel. Rewriting the palette between frames meant every pixel referencing a given slot changed colour simultaneously, which is exactly what an animated texture needs.

the color wheel is shown with different colors and their corresponding complementarys in each section
the color wheel is shown with different colors and their corresponding complementarys in each section
the color wheel is shown with different colors in each section and numbers on each side
the color wheel is shown with different colors in each section and numbers on each side
Rainbow wheel
Rainbow wheel

Developers used the trick constantly. Water in point-and-click adventures rippled without a single new sprite being drawn, lava in platformers bubbled, conveyor belts scrolled, and neon signs blinked in sequence. Amiga demos pushed it further, cycling through carefully graded palettes to create plasma effects and rainbow gradients that filled the screen. Modern pixel artists still use the same logic: Aseprite, GraphicsGale, and similar editors include palette animation features, and sprite sheets for engines like Godot and Unity can bake cycling frames directly into an animation timeline.

Colour Cycles in Web Design and CSS

On the web, colour cycles rarely involve palettes at all. The most common approach is the CSS hue-rotate() filter, which rotates every hue in an element by a number of degrees around the colour wheel. Combined with a keyframe animation running from zero to 360 degrees, it produces a continuous loop that never needs a defined palette because the wheel itself is the palette. Gradient-based cycles built from conic-gradient or layered linear-gradient backgrounds are the other popular route.

AD

More advanced implementations animate CSS custom properties instead. By registering a property with @property and giving it a syntax of <angle> or <color>, the browser can interpolate it smoothly inside gradients, shadows, and borders — things it previously could not animate at all. The trade-off is performance: filter-based cycles can force repaints on large surfaces, while custom property animations are usually cheaper because they can be resolved on the compositor. Testing on mid-range mobile hardware is the only reliable way to know which approach fits your project.

A little guide for Artists!!
A little guide for Artists!!
a circular photo with many different colors and shapes in the center is an image of trees, grass, flowers, and birds
a circular photo with many different colors and shapes in the center is an image of trees, grass, flowers, and birds
colour theory
colour theory
colour wheel 🎡
colour wheel 🎡
four different colored leaves arranged in a circle on the ground with grass and dirt around them
four different colored leaves arranged in a circle on the ground with grass and dirt around them
an image of a circle with many colors in it
an image of a circle with many colors in it

The Science Behind How Colour Cycles Work

Colour models determine what "cycling" actually means. In RGB, a colour is a coordinate in a cube, and there is no natural path around it — you have to invent one. In HSL and HSV, colour is described as hue, saturation, and lightness or value, where hue is an angle on a circle from 0 to 360 degrees. Cycling in those models is simply adding to the angle and wrapping around with a modulo operation, which is why hue rotation feels so intuitive to describe and so easy to implement in code.

Palette-based cycling works differently. There, the cycle is a list, and each frame advances an index. The list does not have to follow any geometric logic, which is its greatest strength: a palette can be hand-tuned so that one direction reads as "flowing water" and another reads as "boiling lava" from the same base artwork. The only hard requirement is that the last colour in the sequence transitions convincingly back into the first.

AD
Cycle typeHow it advancesTypical use
Palette index cyclingIndex shifts by one per framePixel art water, lava, neon
Hue rotationHue angle increases and wraps at 360°CSS effects, icon animation
Gradient offsetGradient stop positions translateUI backgrounds, skeleton loaders
Perceptual cyclingInterpolation in OKLCH or LCHData visualisation, branding

Hue Rotation, Palettes, and Perceptual Pitfalls

The most common mistake in colour cycle design is assuming that HSL hue rotation produces evenly spaced colours. It does not. HSL is a mathematical model, not a perceptual one, so rotating 60 degrees from yellow gives a colour that appears far brighter than one rotated 60 degrees from blue. A naive rainbow cycle therefore pulses in apparent brightness as it spins, which reads as flicker rather than smooth motion.

a rainbow colored circle painted with watercolors on a white background, in the shape of a sun
a rainbow colored circle painted with watercolors on a white background, in the shape of a sun
a color wheel with different colors and the text, simple color wheel chart primary colors secondary colors secondary colors secondary colors secondary colors
a color wheel with different colors and the text, simple color wheel chart primary colors secondary colors secondary colors secondary colors secondary colors
an image of three arrows pointing in different directions
an image of three arrows pointing in different directions
The Role of Color Theory and Kwik Stix in Early Childhood Classrooms
The Role of Color Theory and Kwik Stix in Early Childhood Classrooms

The fix is to work in a perceptually uniform space. OKLCH and its predecessor LCH are designed so that equal numeric steps look like equal visual steps. Cycling lightness and chroma alongside hue in OKLCH produces a gradient that stays visually consistent all the way around the wheel. For pixel art, the equivalent discipline is hand-picking a ramp where each step changes value by a similar perceptual amount, which is why experienced artists build ramps in a dedicated tool rather than eyeballing hex codes.

How the Eye Reads Motion from Colour

The illusion works because of apparent motion. When a bright region shifts position between two frames, the visual system fills in the gap and reports continuous movement rather than two discrete states. In a colour cycle, the "movement" is a gradient of luminance travelling along a path, and the brain interprets that travelling band as a physical object in motion. This is why cycles with clear light-to-dark progression read as flowing water, while cycles that only change hue without changing lightness tend to look static or shimmer unpleasantly.

AD

Speed and direction matter just as much as the palette. Around eight to twelve palette steps per second reads as gentle flow; much faster and the motion smears or becomes uncomfortable. Reversing the cycle direction instantly reverses the perceived current, which is a cheap way to give a scene a sense of tide or wind. It is also worth respecting the prefers-reduced-motion media query, since rapid full-spectrum cycling can trigger discomfort for people with photosensitivity.

Building Your Own Colour Cycle

Every colour cycle, regardless of medium, comes down to three decisions: the sequence of colours, the speed at which the sequence advances, and the direction it travels. Get those right and the implementation is almost trivial. Get them wrong and no amount of clever code will make the animation feel convincing, because the problem is in the palette rather than the engine.

The good news is that the workflow scales. A three-shade water cycle in a 32x32 pixel sprite and a brand gradient that rotates across a hero section use the same conceptual steps; only the tooling differs. Start by defining the loop so that the end matches the beginning, then decide how many frames you need, then wire it up.

A Step-by-Step Workflow

For pixel art, begin by drawing the static shape and isolating the pixels that should animate. Build a palette ramp where each colour differs from its neighbour by a consistent perceptual step, then duplicate the artwork once per palette entry. On each duplicate, shift the animated region's colours one position along the ramp. Export the set as a sprite sheet or as tagged animation frames, and set the playback loop to run continuously without a pause at the wrap point.

For code, the structure is equally direct. Define an array of colours or a starting hue value, advance it on each animation frame, and use modulo arithmetic to wrap around — for example, hue = (hue + delta) % 360. Drive it with requestAnimationFrame rather than a fixed-interval timer so the cycle stays smooth on high refresh rate displays, and prefer animating a single custom property so the browser can optimise the work. If the cycle is decorative, pause it when the tab is hidden.

Common Mistakes and Best Practices

The most frequent failure is a palette that does not loop cleanly, producing a visible jump every time the sequence restarts. The second is over-cycling: saturating an interface with relentlessly shifting colour so that nothing feels stable. The third is relying on colour alone to convey meaning, which breaks for users with colour vision deficiency and for anyone viewing a screenshot in greyscale.

Good colour cycles are restrained and purposeful. Keep the cycling element visually subordinate to content, test the result in greyscale to confirm the motion still reads, and check contrast ratios when text sits over an animated background. Honour reduced-motion preferences, cap the animation speed, and consider offering a static fallback. Done well, a colour cycle adds life and depth for almost no file size — which is precisely why the technique has outlived every platform it was invented for, and why it keeps turning up in places its creators never imagined.

AD