How to Create RELATIVE Colors with hsl(from...) CSS Tutorial

Coding2GO on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateWeb Development5 min

About this video

A short CSS tutorial on the relative colour syntax in hsl(from ...), which derives a colour palette and transparent overlays from one custom property. It shows how this can reduce helper variables and simplify light and dark theming.

What you’ll learn

  • Write hsl(from var(--base-color) h s l / alpha) to derive colours from one custom property
  • Replace helper variables such as --accent-dark with colours calculated from a single base
  • Adjust alpha and lightness to build overlays and dark mode from one base colour