ToolypetMCP
advanced5 minutescss

CSS Custom Properties Theme

Build a theme system using CSS custom properties with gradient, shadow, and animation tokens.

css-variablesthemedesign-tokenscustom-properties

इस रेसिपी का उपयोग कब करें

CSS custom properties enable dynamic theming, dark mode toggling, and design token management without JavaScript. The foundation of modern CSS architecture.

चरण

1

Define gradient tokens

प्रॉम्प्ट:Generate primary brand gradient and express as CSS custom properties: --gradient-primary-start: #3b82f6; --gradient-primary-end: #8b5cf6;
2

Define shadow tokens

प्रॉम्प्ट:Generate 3 shadow elevation levels as CSS variables: --shadow-sm, --shadow-md, --shadow-lg
3

Define animation tokens

प्रॉम्प्ट:Generate easing tokens: --ease-default (smooth), --ease-bounce (springy), --ease-sharp (snappy)
4

Define radius tokens

प्रॉम्प्ट:Generate border-radius tokens: --radius-sm (4px), --radius-md (8px), --radius-lg (16px), --radius-full (9999px)

अक्सर पूछे जाने वाले प्रश्न

CSS variables vs Sass variables?

CSS variables are runtime (change with JavaScript, media queries, cascade). Sass variables are compile-time only. Use CSS variables for theming and Sass for build-time calculations.

How do CSS variables enable dark mode?

Define variables in :root for light mode and override in [data-theme='dark'] or @media (prefers-color-scheme: dark). All components using the variables automatically switch.

संबंधित रेसिपी