Skip to main content

Change colours

Overview

You can update the default theme with your colors to make it fit with your website. Define a few CSS variables in the style property to the EmailPassword.init call. Specify the colors as RGB (see the following example), because the rgb and rgba functions apply them.

For example, if your website uses a dark theme, here is how you can customize it:

Before you start

This example is relevant only if you use the prebuilt UI components.

Example

import SuperTokens from "supertokens-auth-react";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
style: `
[data-supertokens~=container] {
--palette-background: 51, 51, 51;
--palette-inputBackground: 41, 41, 41;
--palette-inputBorder: 41, 41, 41;
--palette-textTitle: 255, 255, 255;
--palette-textLabel: 255, 255, 255;
--palette-textPrimary: 255, 255, 255;
--palette-error: 173, 46, 46;
--palette-textInput: 169, 169, 169;
--palette-textLink: 114,114,114;
--palette-textGray: 158, 158, 158;
}
`,
recipeList: [ /* ... */]
});
Prebuilt form UI with custom color palette
important

Changes to the palette apply to all the UI components provided. If you want to change a specific component, please see this section.

Palette values

Variable NameDescriptionDefault Value
backgroundBackground color of all forms255, 255, 255 (white)
inputBackgroundBackground color of input fields250, 250, 250 (light grey)
inputBorderBorder color of input fields224, 224, 224 (light grey)
primaryPrimary color for focused inputs, success states and button backgrounds28, 34, 42
primaryBorderBorder color for primary buttons45, 54, 68
successColor used for success events65, 167, 0 (green)
successBackgroundBackground color for success notifications217, 255, 191 (green)
errorColor for error highlights and messages255, 23, 23 (red)
errorBackgroundBackground color for error notifications255, 241, 235 (red)
textTitleColor of form titles0, 0, 0 (black)
textLabelColor of form field labels0, 0, 0 (black)
textInputColor of text in form fields0, 0, 0 (black)
textPrimaryColor of subtitles and footer text128, 128, 128 (grey)
textLinkColor of links0, 122, 255 (blue)
buttonTextColor of text in main buttons255, 255, 255 (white)
superTokensBrandingBackgroundColor of SuperTokens branding element242, 245, 246 (Alice blue)
superTokensBrandingTextColor of "Powered by SuperTokens" text173, 189, 196 (heather grey)

We use cookies and similar technologies to help personalize content, analyze site usage, and provide a better experience. By clicking "Accept" you consent to our use of cookies. Visit our Privacy Policy for more information.