Colors with CSS variables

Define your colors once and use them everywhere.

CSS · Colors with CSS variablesBeginner
:root {
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --text: #1f2937;
  --muted: #6b7280;
  --bg: #ffffff;
}

body { color: var(--text); background: var(--bg); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.muted { color: var(--muted); }
variablescustom propertiescolorstheme