Overview
Shipr uses Tailwind CSS v4 with a modern CSS variable-based theming system, supporting seamless dark mode switching and extensive customization options.Global Styles
The main stylesheet is located atsrc/app/globals.css and imports multiple CSS modules:
CSS Variables
Shipr uses CSS custom properties for theme values, defined in OKLCH color space for better perceptual uniformity:Dark Mode Variables
Dark mode overrides are defined in the.dark class:
Theme Configuration
The@theme directive maps CSS variables to Tailwind utilities:
Dark Mode Implementation
Theme Provider
Shipr usesnext-themes for dark mode management. The provider is located at src/components/theme-provider.tsx:
Theme Toggle Component
The theme toggle component (src/components/theme-toggle.tsx) provides a dropdown menu with Light, Dark, and System options:
- Smooth icon transitions between light and dark modes
- Analytics tracking with PostHog
- System preference detection
- Accessible screen reader labels
Customizing Colors
To customize your theme colors:- Edit CSS variables in
src/app/globals.css:
- Use OKLCH color space for better color consistency across light and dark modes
- Update radius for different border radius styles:
Base Layer Utilities
Global styles are applied via the@layer base directive:
Using Theme Colors
Access theme colors in your components using Tailwind classes:Typography
Custom font families are configured in the theme:Best Practices
- Use semantic color names - Prefer
bg-primaryover hardcoded colors - Test both themes - Always verify your UI works in light and dark modes
- Leverage CSS variables - Add custom properties when needed
- Maintain contrast - Ensure sufficient contrast ratios for accessibility
- Use OKLCH - Better perceptual uniformity than RGB or HSL