Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

How to edit default Metronic SASS colors?


What is the best practice for overriding the default SASS color variables?

I am in the process of upgrading Metronic from 8.0.38 to 8.1.0. I notice that SASS uses color variables like:

--kt-primary
--kt-text-muted

Where and how are these colors defined, and how should I override them to make it easy to add future updates without overwriting my custom changes?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


I solved the problem by adding a new CSS file that contains:

:root {
--bs-table-bg-type: #c9c9c9bf;
--bs-text-primary: #2a8fe6;
--bs-text-primary-active: #0077d9;
/* ...etc */
}
This new CSS file should be included after the Metronic CSS files.
But why not just have a theme.css (or something similar) instead?



Hi,

Thanks for the heads-up. The CSS variables are mostly used for the light/dark mode switches and the actual colors should be customized in the SASS level under src/sass/components/_variables.custom.scss
and recompile the assets.

If you need any further clarifications please do let us know.

Regards.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(