Tailwind Configuration
The Tailwind CSS configuration extends the default theme with custom colors, animations, and font families tailored for the portfolio website.Overview
Located intailwind.config.mjs, this configuration file customizes Tailwind CSS with brand colors, smooth animations, and optimized settings.
Configuration Object
Content Sources
Glob patterns that define where Tailwind should look for class names
src directory with the following extensions:
.astro- Astro components.html- HTML files.js,.jsx- JavaScript files.md,.mdx- Markdown files.svelte- Svelte components.ts,.tsx- TypeScript files.vue- Vue components
Dark Mode
Dark mode strategy using the
class approachdark class to the HTML element. This is controlled by the ThemeToggle component (src/components/ThemeToggle.astro).
Theme Extensions
Font Family
Custom font stack with Inter as the primary sans-serif font:Custom sans-serif font stack
- Inter: Modern, professional typeface
- system-ui: System default font fallback
- sans-serif: Generic sans-serif fallback
Custom Colors
Primary Color Scale
A comprehensive blue color palette for primary branding:Lighter Shades
primary-50toprimary-400: Light blue variants for backgrounds and hover states
Core Brand
primary-500: Main brand color (#3b82f6)primary-600: Slightly darker for emphasis
Darker Shades
primary-700toprimary-950: Deep blues for text and dark mode
Accent Color Scale
Cyan accent colors for highlights and interactive elements:Cyan color variants for accents and CTAs
accent-400: Light cyan (#22d3ee)accent-500: Core accent (#06b6d4)accent-600: Dark cyan (#0891b2)
Custom Animations
The configuration includes several custom animations for smooth, engaging interactions:animate-float
animate-float
Duration: 8 seconds
Timing: ease-in-out
Repeat: infiniteCreates a gentle vertical floating effect, moving the element up and down by 20px.
Timing: ease-in-out
Repeat: infiniteCreates a gentle vertical floating effect, moving the element up and down by 20px.
animate-float-delayed
animate-float-delayed
Duration: 8 seconds
Timing: ease-in-out
Delay: 2 seconds
Repeat: infiniteSame as
Timing: ease-in-out
Delay: 2 seconds
Repeat: infiniteSame as
animate-float but starts with a 2-second delay, useful for staggered animations.animate-pulse-slow
animate-pulse-slow
Duration: 4 seconds
Timing: cubic-bezier(0.4, 0, 0.6, 1)
Repeat: infiniteA slower, smoother pulse animation for subtle emphasis.
Timing: cubic-bezier(0.4, 0, 0.6, 1)
Repeat: infiniteA slower, smoother pulse animation for subtle emphasis.
animate-gradient
animate-gradient
Duration: 8 seconds
Timing: ease
Repeat: infiniteAnimates the background position for smooth gradient transitions. Requires a gradient background.
Timing: ease
Repeat: infiniteAnimates the background position for smooth gradient transitions. Requires a gradient background.
animate-border-spin
animate-border-spin
Duration: 5 seconds
Timing: linear
Repeat: infiniteRotates an element 360 degrees continuously. Useful for loading spinners or decorative borders.
Timing: linear
Repeat: infiniteRotates an element 360 degrees continuously. Useful for loading spinners or decorative borders.
Keyframes
The animations are defined using custom keyframes:Plugins
Usage Examples
Combining Custom Utilities
Dark Mode Patterns
Integration with Astro
The Tailwind configuration is integrated with Astro via the@astrojs/tailwind integration:
Base Styles Disabled: The configuration uses
applyBaseStyles: false, meaning Tailwind’s base reset styles are not applied. This gives more control over default styling.Best Practices
Related Files
tailwind.config.mjs: Configuration file (tailwind.config.mjs:1)astro.config.mjs: Astro integration (astro.config.mjs:5)src/components/ThemeToggle.astro: Dark mode toggle (src/components/ThemeToggle.astro:1)