Skip to content

Customize Bootstrap 5.3 with CSS variables #39551

Closed Answered by julien-deramond
manuelmeurer asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @manuelmeurer

So right now, tweaking the --bs-primary CSS variable to give all components a new color isn't possible. You can see --bs-primary primarily as a read-only CSS variable reusable in your website to get the primary color. For a consistent global look and setting a new primary color, diving into Sass is the way to go.

However, as explained in the article, depending on the needs, it's possible to override the rendering of the components one by one by overriding their CSS variables.

Some improvements will be made when Bootstrap is refactored in v6 for an easier theming approach. The groundwork with CSS variables and color modes in v5.2/3 was the opening act, and we committed to…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by julien-deramond
Comment options

You must be logged in to vote
0 replies
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