I need to make a custom component in stencil where the color is dynamic. Any way to take the value of variable from tsx and access it on scss file.
The code is below.
The only styling variables you will be able to read at runtime are CSS custom properties.
CSS/SCSS :
:root {
--foo-bar: red;
}
JS/TS :
var bodyStyles = window.getComputedStyle(document.body);
var fooBar = bodyStyles.getPropertyValue('--foo-bar'); //get red