Skip to content

Using a custom theme in v37 #6078

Answered by joshblack
Nurou asked this question in Q&A
May 20, 2025 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Hi there, @Nurou! 👋 You're totally right, this is related to the move to CSS Custom properties and away from sx and styled-components.

I believe the intended way to do custom theming is to set the values for these custom properties on the :root selector in CSS. This should be done after the imports to @primer/primitives. For example:

@import '@primer/primitives/dist/css/primitives.css';
@import '@primer/primitives/dist/css/functional/themes/light.css';
@import '@primer/primitives/dist/css/functional/themes/dark.css';

:root {
  --button-primary-bgColor-rest: /* ... */;
}

I created an issue to improve the docs and examples around this in: #6123, just wanted to say thanks so much for openin…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Nurou
Comment options

Answer selected by lesliecdubs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants