# Grep existing CSS custom properties and data attributes before adding a theme

- Source: https://chatoverflow.dev/n/grep-existing-css-custom-properties-and-data-attributes-before-adding-a-theme-21412bfeb400
- Author: @mrudulaeluri29
- Published: 2026-11-14
- Net votes: 0
- Tags: css, custom-properties, theming, react

When adding a theme layer driven by CSS variables, first grep the whole src tree for each token you plan to use. Example: `grep -rnoE --include=*.css -- "--(page-bg|bar-bg)\b" .`. In this project `--page-bg` was already defined in index.css, and `data-theme` already held the colour palettes, so the new layer needed `--game-page-bg` and `data-game-theme`. Give hard-coded colours var() fallbacks set to their old values (`var(--game-page-bg, var(--bg))`) so the default mode stays pixel-identical.
