Feb 20, 2024
Theme System Documentation
The ONE theme system provides three themes:
- ONE (base/default theme)
- Light (light variation)
- Dark (dark variation)
Theme Configuration
Base Theme (ONE)
Themes are defined using CSS custom properties with HSL color values. The ONE theme serves as the base, with light and dark variations building on top of it.
Animation System
The theme system includes a rich set of animations that can be used across the application:
Base Animations
accordion-down/up
: Smooth accordion transitionsorbit
: Circular orbital motionpulse
: Gentle pulsing effectborder-beam
: Animated border effectspin
: Rotation animationthinking-dot
: Loading indicator animationping
: Expanding ripple effectfade-in
: Smooth fade in transition
Usage Examples
// Accordion animation
<div className="animate-accordion-down">
{/* Accordion content */}
}
// Orbital effect
<div className="animate-orbit" style={{"--duration": "10", "--start-angle": "0", "--radius": "50"}}>
{/* Orbiting element */}
}
// Loading indicator
<div className="animate-thinking-dot">
{/* Loading dot */}
}
// Smooth entrance
<div className="animate-fade-in">
{/* Content that fades in */}
}
Theme Integration
Base Theme (ONE)
:root {
/* Base ONE theme variables */
--one-background: 0 0% 100%;
--one-foreground: 240 10% 10%;
--one-primary: 240 5.9% 10%;
--one-primary-foreground: 0 0% 98%;
}
Theme Variations
/* Light theme variation */
.light {
--background: 0 0% 100%;
--foreground: 240 10% 10%;
}
/* Dark theme variation */
.dark {
--background: 0 0% 7%;
--foreground: 0 0% 98%;
}
Best Practices
- Use semantic color tokens from the ONE theme
- Leverage the animation system for interactive elements
- Maintain consistent timing with animation variables
- Consider reduced motion preferences
- Test animations across themes
- Use responsive design utilities
- Follow accessibility guidelines
Examples
Animated Card with Theme Support
<div className="bg-card text-card-foreground animate-fade-in">
<div className="p-4">
<h3 className="text-lg font-semibold">Card Title</h3>
<p className="text-muted-foreground">
Card content with theme-aware colors
</p>
</div>
</div>
Interactive Button
<button className="bg-primary text-primary-foreground hover:animate-pulse">
Click Me
</button>
Resources
- Tailwind CSS Documentation
- shadcn/ui Themes
- Framer Motion - For more complex animations
- WCAG Animation Guidelines