I am currently working on enabling custom theming for my component that utilizes bootstrap. I am aiming to define its $primary tag in SCSS within the section of the Vue component. Currently, my styling setup looks like this:
<style scoped lang="scss">
$primary: #FF1493;
// Bootstrap and its default variables
@import "../../node_modules/bootstrap/scss/bootstrap";
// BootstrapVue and its default variables
@import "../../node_modules/bootstrap-vue/src/index.scss";
@import "src/assets/custom.scss";
</style>
My goal is to make that hex code adaptable based on a prop received by the component. Thank you for your assistance.
Following advice from a comment, an attempt was made but did not yield the desired outcome:
<template>
<div style="style="{ '--test': #ff1493 }"">
</div>
</template>
<style scoped lang="scss">
$primary: var(--test);
// Bootstrap and its default variables
@import "../../node_modules/bootstrap/scss/bootstrap";
// BootstrapVue and its default variables
@import "../../node_modules/bootstrap-vue/src/index.scss";
@import "src/assets/custom.scss";
</style>
This resulted in a compile error in the SCSS:
SassError: argument `$color` of `darken($color, $amount)` must be a color
on line 181 of node_modules/bootstrap/scss/_variables.scss, in function `darken`
from line 181 of node_modules/bootstrap/scss/_variables.scss
from line 9 of node_modules/bootstrap/scss/bootstrap.scss
from line 201 of D:\Documents\Code\SiliconGit\src\components\SiDialog.vue