Rege
css1 min read

Dynamic Colors with Relative Color Syntax

Modify colors directly in CSS with relative syntax

Rege

@rege_dev

Relative Color Syntax allows you to take any existing color and modify it on the fly, such as adding transparency to a variable. Read more on MDN →

CSS

.element {
  --brand-color: #3b82f6;

  /* Modify the color directly! */
  background-color: rgb(from var(--brand-color) r g b / 50%);
}
Base Color
#3b82f6
50% Opacity
Derived dynamically

© 2026 rege. All rights reserved.