Overriding CSS Variables
The easiest way to customize Oat is by overriding CSS variables in your own stylesheet. All theme variables are defined on the:root selector and can be overridden globally or scoped to specific elements.
Global Customization
Create a custom stylesheet and override variables globally:Dark Mode Customization
Oat uses thelight-dark() CSS function for automatic theme switching. You can customize both light and dark mode values:
prefers-color-scheme setting.
Component-Specific Customization
You can scope variable overrides to specific components:Custom Color Schemes
Create a complete custom color scheme by overriding all color variables:Custom Typography
Customize font families, sizes, and weights:Custom Spacing Scale
Adjust the spacing scale to match your design system:Custom Shadows
Modify shadow styles for different depth levels:Custom Transitions
Adjust animation timing:Loading Custom Fonts
When using custom fonts, load them before overriding font variables:Component-Level Customization
You can also customize individual component instances:Best Practices
- Use CSS variables: Don’t override component CSS directly. Always use CSS variables for customization.
- Maintain consistency: Keep your customizations consistent across light and dark modes.
- Test accessibility: Ensure color contrasts meet WCAG guidelines when customizing colors.
- Document your theme: Keep a reference of your custom variables for team consistency.
- Use semantic names: If creating new variables, follow Oat’s naming conventions.