Theme Basics
Fumadocs UI adds its own colors, animations, and utilities through a Tailwind CSS preset. The design system is inspired by Shadcn UI and uses CSS variables for easy customization.Built-in Theme Presets
Choose a Preset Theme
Fumadocs comes with 11 beautiful preset themes. Import your preferred theme in your CSS:app/globals.css
neutral.css- Clean neutral gray theme (default)black.css- High-contrast black themevitepress.css- VitePress-inspired themedusk.css- Warm purple dusk themecatppuccin.css- Popular pastel themeocean.css- Cool ocean blue themepurple.css- Vibrant purple themesolar.css- Warm solar themeemerald.css- Fresh emerald green themeruby.css- Bold ruby red themeaspen.css- Natural aspen theme
Shadcn UI Integration
If you’re using Shadcn UI, use theshadcn preset to automatically adopt colors from your existing theme:app/globals.css
Preview Theme Changes
Restart your dev server to see theme changes:Custom Color Scheme
Understanding Color Variables
Fumadocs uses CSS variables with thefd- prefix for theming. All colors use HSL format:background/foreground- Base colorsmuted/muted-foreground- Secondary elementscard/card-foreground- Card backgroundspopover/popover-foreground- Dropdown menusborder- Border colorsprimary/primary-foreground- Primary actionssecondary/secondary-foreground- Secondary actionsaccent/accent-foreground- Highlighted elementsring- Focus ring color
Create Custom Light Theme
Define your custom colors inglobal.css using the @theme directive:app/globals.css
Test Your Custom Theme
Use the theme toggle in your docs to switch between light and dark modes and verify all colors work well in both themes.Layout Customization
Adjust Layout Width
Customize the maximum width of your documentation layout:app/globals.css
1280px- Default1400px- Wider layout1600px- Extra wide100%- Full width
RTL (Right-to-Left) Support
Enable RTL layout for languages like Arabic or Hebrew:app/layout.tsx
Typography Customization
Add Custom Fonts
Fumadocs doesn’t include a default font. Add your preferred font usingnext/font:app/layout.tsx
Customize Typography Plugin
Fumadocs includes a built-in typography plugin (forked from Tailwind CSS Typography). Use theprose class for rich content:@tailwindcss/typography alongside, change the class name to avoid conflicts:app/globals.css
Advanced Customization
Custom Sidebar Styling
Customize sidebar appearance in your docs layout:app/docs/layout.tsx
Custom Navigation
Customize the navigation bar:lib/layout.shared.tsx
Custom Theme Toggle
The theme toggle is included by default. Customize it through the Root Provider:app/layout.tsx
Styling MDX Components
Override Default Components
Customize MDX components with your own styles:mdx-components.tsx
Custom Callout Styles
Create custom callout variants:Color Palette Generator
To generate a cohesive color palette:- Choose a primary color (e.g.,
hsl(221, 83%, 53%)) - Generate lighter/darker variants for background and foreground
- Create muted versions with reduced saturation
- Test contrast ratios for accessibility (aim for 4.5:1 minimum)
- HSL Color Picker
- Contrast Checker
- Coolors for palette generation
Best Practices
- Maintain Consistency: Use the same color variables throughout your documentation
- Test Both Themes: Always verify your customizations work in both light and dark modes
- Check Accessibility: Ensure sufficient contrast ratios for readability
- Use Semantic Colors: Follow the semantic naming (primary, secondary, accent) for predictable behavior
- Start with Presets: Begin with a preset theme and customize from there
Troubleshooting
Colors Not Changing
If your custom colors aren’t applied:- Ensure you’re using the
@themedirective in Tailwind CSS 4 - Check that you’re not importing a preset after your custom colors
- Clear your browser cache and restart the dev server
Dark Mode Not Working
If dark mode doesn’t work:- Verify
suppressHydrationWarningis on the<html>tag - Check that
.darkclass selector is used for dark theme variables - Ensure
RootProviderwraps your application
Fonts Not Loading
If custom fonts don’t appear:- Verify the font variables are applied to the
<html>tag - Check that Tailwind is configured to use the font variables
- Ensure the font files are properly imported
Next Steps
- Add search functionality to your themed docs
- Set up multiple docs with different themes
- Explore UI components for more customization options