Topic: Best practice changing primary color at runtime

baasjedave premium asked 4 months ago

Hi there,

For our project we're looking for the best way to customize the primary color at runtime (using css custom properties / css variables). Our customers can use their brand-color to customize the colors used in the webapplication.

When I change the --mdb-primary css variable, it's not enough to change a lot of components using that color...

We prefer to achieve our goal without involving sass at serverside, however I wonder if compiling sass at serverside is advisable or we always should avoid that.

Looking forward to here from you! Thanks in advance!

Grzegorz Bujański staff answered 4 months ago

For now, the only solution is to overwrite the CSS variable. Changing the primary color using CSS variables is not yet supported in some components. This will change in the future, but for now, the only solution is to overwrite the SCSS variable

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.1.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No