Update 2021 for Bootstrap 5
Per the guidance in the docs…
“Variable overrides must come after our functions are imported, but
before the rest of the imports.”
Therefore, overriding the theme-colors in Bootstrap 5 works the same way as 4.x. In order to override the theme-colors, simply change appropriate theme color variable before importing bootstrap.scss
/* custom.scss */
/* change theme colors */
$primary: #362ec4;
$secondary: #8f5325;
$success: #3e8d63;
$info: #7854e4;
$warning: #b8c924;
$danger: #d62518;
/* end custom.scss */
@import '~bootstrap/scss/bootstrap.scss';
Update 2018 for Bootstrap 4.1
To change the primary, or any of the theme colors in Bootstrap 4 SASS, set the appropriate variables before importing bootstrap.scss
. This allows your custom scss to override the default value, and will then be set in all the theme-colors
loops (btn-primary, bg-primary, text-primary, etc..)…
/* import the necessary Bootstrap files */
@import "bootstrap/functions";
@import "bootstrap/variables";
$theme-colors: (
primary: #333333;
);
/* finally, import Bootstrap */
@import '~bootstrap/scss/bootstrap.scss';
Demo: https://www.codeply.com/go/lobGxGgfZE