Change color by index

Sibling Index

With sibling-index and sibling-count, we can do visual changes to a UI based on the total number of siblings, or the index of the current sibling.

.item {
  --size: 3rem;
  --l: calc(3 * sibling-index());
  background-color: hsl(from deeppink h s calc(l + var(--l)));
}

Take a look at the demo below and resize the wrapper.

Full Screen