Skip to content

How can I create my own theme? #1544

Discussion options

You must be logged in to vote

Hey @GhostOrder28 - sorry if this wasn't clear from the docs. We don't really support referencing design tokens like that at this time. If you wanted to use customColor in a component, you would need to reference the value directly from the theme (probably through the useTheme hook, which is generically typed)

interface CustomTheme extends Theme {
  colors: {
    customColor: string;
  };
}

const customTheme: CustomTheme & DefaultTheme = mergeTheme(defaultTheme, {
  colors: {
    customColor: "#2596be"
  }
});

// app.tsx or equivalent 'root' component
const App = () => {
  return (
    <ThemeProvider value={customTheme}>
      {...}
    </ThemeProvider>
  );
};

// Some custom component…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@GhostOrder28
Comment options

@brandongregoryscott
Comment options

@GhostOrder28
Comment options

Answer selected by GhostOrder28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
theming Question, feedback, etc. around theming architecture
2 participants