π― Why index.css
Exists
Our index.css
file:
- Sets up base styles (font, spacing, resets)
- Defines design tokens (colors, radii, fonts) as CSS variables
- Enables dark mode with one toggle
- Supports custom animations (like marquees)
- Powers all Tailwind utility classes
π§ How It Works (Core Concepts)
1. Tailwind + Custom Layers
We start by importing the basics:2. CSS Variables (Design Tokens)
Global theme variables live under:root
, like:
3. Dark Mode = .dark
Class
Dark theme overrides the same variables:
.dark
class on <html>
or <body>
.
4. Custom Animations (Optional)
Extras like marquee animations:π‘ Want Your Own Theme?
Use TweakCN to generate your own Tailwind-compatible themes. Just copy the variables into:root
and .dark
blocks.
β Component Example
π§ Final Notes
- Use
bg-*
,text-*
,shadow-*
βthey all reflect your theme - All design tokens live in
index.css
- Tailwind config is extended to reference them
- Dark mode? Just toggle
.dark
index.css
.
For more, check the Tailwind theming docs or try TweakCN to craft your palette.