Themes & Color Modes
Learn how to implement themes and color modes in Cerberus Design System
Overview
Cerberus provides support for themes and color modes, allowing you to create visually appealing and accessible applications that adapt to user preferences.
Themes
To use a theme, just add the data-panda-theme
attribute to your root html
tag.
1<html lang="en" data-panda-theme="cerberus">2 <body>{children}</body>3</html>
Cerberus comes with two built-in themes: cerberus
and acheron
. You can switch between these themes by changing the value of the data-panda-theme
attribute.
Color Modes
Cerberus supports two color modes: light
and dark
. You can set the default color mode by adding the data-color-mode
attribute to your root html
tag.
1<html lang="en" data-panda-theme="cerberus" data-color-mode="light">2 <body>{children}</body>3</html>
Color mode works the same way as themes. You can switch between light and dark modes by changing the value of the data-color-mode
attribute.
Nesting themes and color modes
You can also nest themes and color modes within your application using the Theme
component. This is useful when you want to apply a different theme or color mode to a specific section of your app.
1<html lang="en" data-panda-theme="cerberus" data-color-mode="light">2 <body>3 <Text>This text is in the Cerberus theme and light mode</Text>4
5 <Theme theme="acheron" mode="dark">6 <Text>This text is in the Acheron theme and dark mode</Text>7 </Theme>8 </body>9</html>
Custom Themes and Color Modes
You can create your own themes and modes by extending your panda.config.ts
file. For more information, check out the Multi-Theme Support sections in the PandaCSS documentation.
On this page