01.26 · Scroll-Based
Scroll-Driven Background Color
The background color changes as you scroll through sections. Best for stories.
Scroll it
Scroll inside the box, or press Play and it scrolls for you.
Inside, the strip is the whole scroll: each chapter's color, how they meet and, on light colors, where the text turns dark. The marker shows your place; scroll the box or press Play.
One color keeps the background the same throughout; Changes by chapter moves from each chapter's color to the next as you scroll. Scroll the box or press Play to watch.
Try it
Change a setting, then scroll again or press Play.
Colors
On Daylight and Forest the text turns dark on light colors.
Blend
Hard cut shows the change with no blending at all.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add a scroll-driven background color to [the sections of your page]. Give each section a color, and as the visitor scrolls, change the page background from one section's color to the next in step with their position, blending between them unless the settings ask for a hard cut, so the color follows the scroll both ways. Blend in a perceptual color space so the colors in between stay clean. Check the text against the background at every point, and switch the text to dark when the background turns light. A change of color is not movement, so keep it when the visitor has reduced motion turned on. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.