Customizing Theme

Customizing the theme in gluestack-ui with nativewind involves defining a theme configuration and applying it using GluestackUIProvider, enabling you to style your application's visual elements according to your design preferences.
Customizing Tokens

Customizing Tokens

gluestack-ui, integrated with Nativewind, seamlessly accommodates the default Tailwind CSS theme, allowing users to effortlessly expand and customize it to suit their needs.
gluestack-ui with nativewind also ships with a set of handpicked default color palette tokens which are mapped seperately with each mode. For example, the default color palette for light mode is light and the default color palette for dark mode is dark.
To customize tokens, follow these steps:
  1. Step
    1
    :
    Go to gluestack-ui-provider/config.ts file. Update or add new tokens as per your requirements.
export const config = {
light: vars({
... // other tokens
//updated '--color-primary-0' value
'--color-primary-0': '#C0C0C0',
/* Added a new background color for light mode */
'--color-background-new': '#BAE7FC',
}),
dark: vars({
... // other tokens
/* Added a new background color for dark mode */
'--color-background-new': '#89D6FA',
}),
};
  1. Step
    2
    :
    In case you are adding a new color in your config file, you need to update it in the tailwind.config.js file as well.
theme: {
extend: {
colors: {
background: {
... // other color values,
/* Added a new background color */
new: 'var(--color-background-new)',
},
},
},
plugins: [],
},
You can customize all the tokens in config. For a complete list of tokens and default values, please check default Tokens.
By utilizing this approach, you can seamlessly modify the primary color tokens of the theme while maintaining the overall theme configuration intact.
If you want to extend the default tailwind config and add fonts, breakpoints, border radius values, and more, please refer to the tailwindcss documentation.
Edit this page on GitHub