Configuration Guide: Catppuccin for MkDocs!!!!!¶
This guide will help you integrate all 4 Catppuccin flavors into your own MkDocs project.
Prerequisites¶
Before you begin, make sure you have the following installed:
Step 1: Project Structure¶
Create the following structure in your project:
Step 2: Create the CSS File with Catppuccin Themes¶
Create the file docs/stylesheets/extra.css and add all 4 Catppuccin flavors.
CSS File Structure¶
The CSS file should contain:
- Color Palette Definitions - all 4 flavors
- Configuration for Each Flavor - Material theme variable settings
- Common Styling - styles applied to all themes
Example Palette Definition¶
Applying Colors to Material Theme¶
Complete CSS File
The complete example CSS file with all 4 flavors is located in the docs/stylesheets/extra.css file of this repository.
Step 3: Configure mkdocs.yml¶
Edit your mkdocs.yml file:
Basic Configuration¶
Palette Configuration with All 4 Flavors¶
Why 'custom' for primary and accent?
Setting primary: custom and accent: custom tells Material for MkDocs to use the CSS variables we define in extra.css instead of the built-in color schemes.
Including the CSS File¶
Useful Markdown Extensions¶
Step 4: Complete mkdocs.yml Structure¶
Here's a complete example configuration file:
Step 5: Run and Test¶
Local Development¶
Start the local server for preview:
Open your browser at http://127.0.0.1:8000/
Check Themes¶
- Find the theme toggle icon in the top right corner
- Click it to switch between themes
- Verify that all 4 flavors display correctly
Browser Cache
If styles don't update, clear your browser cache with Ctrl+F5 (or Cmd+Shift+R on Mac).
Step 6: Deploy¶
GitHub Pages¶
Add a GitHub Action for automatic deployment:
Create the file .github/workflows/deploy.yml:
Other Platforms¶
Customizing Colors¶
Changing the Accent Color¶
If you want to change the primary or accent color for a specific flavor, edit the variables in extra.css:
Available Catppuccin Colors¶
Each flavor has the following colors:
| Category | Colors |
|---|---|
| Backgrounds | base, mantle, crust |
| Surfaces | surface0, surface1, surface2 |
| Overlays | overlay0, overlay1, overlay2 |
| Text | subtext0, subtext1, text |
| Blues | lavender, blue, sapphire, sky |
| Greens | teal, green |
| Yellows | yellow, peach |
| Reds | maroon, red |
| Purples/Pinks | mauve, pink |
| Pastels | flamingo, rosewater |
Color Examples by Flavor¶
Advanced Customization¶
Adding Custom Styles¶
You can add your own styles after the Catppuccin styles in extra.css:
Configuring Navigation¶
In mkdocs.yml, you can customize the navigation structure:
Custom Logo and Favicon¶
Add a logo and favicon to your theme:
Place your logo and favicon files in docs/assets/.
Common Issues¶
Theme Not Applying¶
- Verify the path to
extra.cssis correct inmkdocs.yml - Check that the
extra.cssfile is indocs/stylesheets/ - Clear browser cache (Ctrl+F5 or Cmd+Shift+R)
- Check browser console for CSS loading errors
Colors Look Wrong¶
- Verify that
schemeinmkdocs.ymlmatchesdata-md-color-schemein CSS - Ensure all CSS variables are properly defined
- Check for CSS syntax errors (missing semicolons, brackets, etc.)
- Verify the color hex codes are correct
Theme Toggle Not Working¶
- Make sure you have defined multiple palettes in
mkdocs.yml - Check that the
togglesections are properly configured - Verify each palette has a unique
schemename - Ensure JavaScript is enabled in your browser
Build Errors¶
Performance Optimization¶
Reducing CSS Size¶
If you only need specific flavors, remove unused ones from extra.css:
Caching¶
Enable caching in your web server for static files:
Accessibility¶
Catppuccin themes are designed with accessibility in mind:
- WCAG AA Compliant: All themes meet WCAG 2.1 AA standards
- High Contrast: Sufficient contrast ratios for readability
- Color Blind Friendly: Tested with various color vision deficiencies
Migration Guide¶
From Default Material Theme¶
- Install Catppuccin CSS file
- Update
mkdocs.ymlpalette configuration - Change
primaryandaccenttocustom - Test all 4 flavors
From Other Themes¶
- Remove old theme configuration
- Follow the installation steps in this guide
- Update any custom CSS to use Catppuccin variables
- Test thoroughly
Best Practices¶
Theme Selection¶
- Latte: Use for documentation that may be printed
- Frappé: Good default dark theme
- Macchiato: Popular choice for developer docs
- Mocha: Best for late-night coding sessions
Color Usage¶
- Use primary color for navigation and headers
- Use accent color for links and interactive elements
- Use background colors for cards and containers
- Maintain consistency across pages
Typography¶
Useful Resources¶
- Catppuccin Official Site
- Catppuccin Style Guide
- Material for MkDocs Documentation
- MkDocs User Guide
- Catppuccin Color Palette
- Material Icons
Community and Support¶
If you encounter issues:
- Check Catppuccin Issues
- Review Material for MkDocs Discussions
- Join the Catppuccin Discord
- Create an issue in your repository with details
Contributing¶
Contributions are welcome! If you improve the theme integration:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Enjoy beautiful documentation with Catppuccin! ☕