Overview
Thetailwind.config.ts file configures Tailwind CSS for the portfolio template. It defines the design system including colors, spacing, typography, animations, and custom utilities.
Configuration File
Here’s the complete Tailwind configuration:tailwind.config.ts
Configuration Breakdown
Dark Mode
dark class on the root element. This approach:
- Gives complete control over when dark mode is active
- Allows manual theme switching
- Works with localStorage to persist user preference
- More predictable than media query-based dark mode
Content Sources
src/ with common web file extensions. Tailwind will only include CSS for classes actually used in these files, keeping your bundle small.
Container Configuration
center: true: Automatically centers the container withmargin: 0 autopadding: "2rem": Adds horizontal padding on all breakpointsscreens: Sets maximum width of1400pxfor 2xl breakpoint (prevents content from becoming too wide on large displays)
Theme Extensions
CSS Variable-Based Colors
The color system uses CSS variables for easy theming:- Theme colors defined once in CSS variables
- Easy to switch between light and dark themes
- Runtime theme customization
- Consistent color usage across components
| Color | Purpose | Usage |
|---|---|---|
background | Page background | Main canvas color |
foreground | Primary text | Body text, headings |
primary | Brand color | CTAs, links, highlights |
secondary | Secondary actions | Less prominent buttons |
muted | Subtle backgrounds | Disabled states, subtle sections |
accent | Accent highlights | Hover states, notifications |
destructive | Error/danger states | Delete buttons, errors |
border | Borders | Component outlines |
input | Input borders | Form field borders |
ring | Focus rings | Focus indicators |
card | Card backgrounds | Elevated surfaces |
popover | Popover backgrounds | Tooltips, dropdowns |
Border Radius
Typography
Custom Animations
Accordion Animations
Appear Animation
Plugins
tailwindcss-animate
- More animation presets
- Enhanced timing functions
- Better animation control utilities
@tailwindcss/typography
prose class for beautiful typography in content-heavy areas. Perfect for blog posts and documentation.
Usage:
- Sensible defaults for headings, paragraphs, lists
- Properly styled links and code blocks
- Dark mode support with
prose-invert - Responsive typography sizing
Customization Guide
Changing Primary Colors
Colors are defined in your global CSS file using CSS variables:Adding Custom Colors
Changing Fonts
-
Import your font in your layout:
-
Update the config: