Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThemeProvider not providing theme to createGlobalStyles #65

Closed
stephenkoo opened this issue Oct 10, 2019 · 2 comments
Closed

ThemeProvider not providing theme to createGlobalStyles #65

stephenkoo opened this issue Oct 10, 2019 · 2 comments

Comments

@stephenkoo
Copy link

馃悰 Bug Report

createGlobalStyle components are unable to use themes.

To Reproduce

import { ThemeProvider, createGlobalStyle } from '@xstyled/styled-components';

const theme = {
  colors: {
    background: '#000',
  }
}

const GlobalStyle = createGlobalStyle`
  body {
    background-color: background; // Does not work, generates CSS: `background-color: background` instead of #000
  }
`
<ThemeProvider theme={theme}>
  <>
    <GlobalStyle />
    <App />
  </>
</ThemeProvider>
@gregberge
Copy link
Collaborator

It works great, I use it in projects. Could you please reopen a new issue with a repro example on CodeSandbox please?

@kmvan
Copy link

kmvan commented Feb 18, 2021

background-color: ${({theme}) => theme.color.background}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants