I have setup Bootstrap 4 theme variables as follows:
// custom-theme.scss
$primary: green;
$secondary: purple;
Then custom variables like:
// custom-variables.scss
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
$idi-primary-12: theme-color-level(primary, -12);
Then importing all as follows:
//main.scss,
@import "./bootstrap-theme";
@import "./custom-variables";
@import '~bootstrap/scss/bootstrap';
This updates bootstrap classes like btn-primary and text-secondary AS EXPECTED (nice);
But the custom variable ($idi-primary-12) based on my $primary doesn't work. I was using the theme-color-level SASS function as given here in the official documentation.
When I use this in my component,
// myComponent.scss
@import "../custom-variables";
.myUserInfo {
background-color: $idi-primary-12;
color: color-yiq($idi-primary-12);
}
I get BLUE shade (which is the default in the bootstrap/scss/variables.scss). Github source instead of my override (green - as set above)
Question: How do I use theme-color-level function, to use my $primary (green) variable to generate a lighter version of that green? (and not the default blue).
Additional info: official documentation for SASS functions
theme-color-levelusestheme-colortheme-colorextracts from object$theme-colorsby key (I am using primary)$theme-colorsprimary key is set to$primary(Github for $theme-colors)$primaryis set to blue (Github for $primary)- This should have be overridden by my
$primary = green;from custom-theme.scss. That is why btn-primary is working. (shown as green). But why isn't it using that same overridden variable to create my$idi-primary-12variable?