Themes are the heart of the Skeleton design system. They are created using CSS custom properties, but authored as CSS-in-JS to enable simple integration into the Skeleton Tailwind plugin. Allowing you to quickly pre-register and swap between themes on demand.
Preset Themes
Skeleton comes with a selection of high quality themes out of the box.
cerberus
catppuccin
pine
rose
TIP: Use the theme switcher on this documentation website to preview each theme.
To use preset themes, add the following import to the top of your tailwind.config
, then refer to Register and Active below.
Custom Themes
Optionally you can choose to generate a custom theme to match the unique branding and design required for your application. Skeleton provides a robust theme generator to simplify this process.
- Open the Theme Generator and design your theme.
- Tap the “code” view from the menu options at the top of the site.
- Provide a unique name for your theme.
- Copy the contents of the generated theme in full.
- Create a new file in the root of your project called
theme-custom.ts
(this is up to you).
You may import your custom theme(s) at the top of your project’s tailwind.config
, then refer to Register and Active below.
Register and Activate
Make sure you followed the import instructions above, then register all themes within the Skeleton Tailwind Plugin found within your project’s tailwind.config
.
TIP: There’s no limited to how many themes you can enable, but each increases the size of your final CSS bundle.
Finally, you can set the current active theme using the data-theme
attribute on <body>
tag. If this doesn’t exist, add it.
To switch themes, use the tools provided by your framework to modify the data attribute and apply a registered theme’s name.
Customizing Presets
You may update the CSS Custom Properties provided by Skeleton’s preset themes. Use the following syntax and apply these styles changes to your global stylesheet. This will target the root scope, a specific theme, and each theme property you wish to adjust.
Enhancing Themes
While themes act as the foundation of your application’s style, they should not be seen as the only option for customizing your application. By combining Skeleton and Tailwind elements into grouped new utility classes, you can create complex styles.
Simple Card
This card will always use the same styles.
Enhanced Card
This card will have unique styles for the Cerberus and Catppuccin themes.
Please note that Tailwind discourages early abstraction. The @apply
feature should not be used as a replacement for utility classes. However, grouping a small subset of utility classes for resusability is allowed. Use this technique with caution.
Custom Fonts
COMING SOON: we’ll provide a Cookbook article on this subject as instruction may vary per meta-framework.
API Reference
COMING SOON: please refer to the preset Cerberus theme, which contains inline documentation.