Skip to main content

Overview

Astro Portfolio v3 uses Tailwind CSS v4 with a modern theming system that supports light, dark, and retro modes. The styling is managed through CSS custom properties (CSS variables) for easy theme customization.

Tailwind CSS v4 Setup

The project uses the new Tailwind CSS v4 syntax with inline configuration in the global stylesheet.

Global Styles Location

All styles are defined in src/styles/global.css:
src/styles/global.css

Theme System

The portfolio includes three built-in themes:
The default light theme with a clean, minimal aesthetic using neutral colors.

Color System

The theme uses a semantic color system based on OKLCH color space for perceptual uniformity:
color
Main background color for the page
color
Main text color
color
Primary brand color used for important UI elements
color
Secondary accent color for highlights and links
color
Muted background color for subtle elements
color
Accent color for emphasis
color
Border color for dividers and outlines
color
Background color for cards and elevated surfaces

Customizing Colors

To customize your theme colors, edit the CSS variables in src/styles/global.css:
src/styles/global.css
The project uses OKLCH color space for better color consistency. Use tools like OKLCH Color Picker to generate colors.

Custom Utilities

The project includes several custom utility classes:

Container Fluid

A responsive container with consistent padding:
Usage:

First Letter Color

Applies accent color to the first letter of text:
Usage:

Custom Animations

The theme includes several custom animations for smooth transitions:

Staggered Animations

Create beautiful staggered entrance animations:

Theme-Specific Styling

Use custom variants to apply styles based on the active theme:

Custom Border Radius

The theme includes a flexible border radius system:
Usage:

Typography

The site uses the Inter font family loaded through Astro’s Font API:
src/layouts/Layout.astro
Apply it globally:
Be careful when modifying animation durations, as they’re synchronized with Astro’s view transitions. Changes may cause visual glitches during page navigation.

Class Utility Function

The project includes a cn() utility function for merging Tailwind CSS classes intelligently. This function combines clsx and tailwind-merge to handle conditional classes and resolve Tailwind conflicts. Location: src/lib/utils.ts
src/lib/utils.ts
Usage:
This utility is particularly useful for:
  • Conditional class application
  • Resolving conflicting Tailwind classes
  • Building dynamic class strings for components

Best Practices

1

Use CSS Variables

Always use CSS variables for colors to maintain theme consistency
2

Test All Themes

Test your customizations in all three themes (light, dark, retro)
3

Maintain Accessibility

Ensure sufficient color contrast ratios for text readability
4

Use Semantic Colors

Use semantic color names (primary, secondary) instead of specific colors (blue, red)