from your question I guess that you want to enable theming, so here is solution which isn't related directly to your question but give you a better insight on how this could be worked out
.theme1{
--primary-color: red;
}
.theme2{
--primary-color: blue;
}
// inside component1
:host{
background-color : var(--primary-color);
}
//inside the AppComponent
<body[class]="isTheme1? 'theme1': 'theme2'">
<component1></component1>
</body>
to explain it. each css variable is scoped to its style. meaning if style1 is applied to the component or parent, then the value that is available inside that component will read from the parent/self element
<!-- scoped to the body-->
<bod class="theme1">
<div>
<component1> </component1>
</div>
<div>
<component1> </component1>
</div>
</body>
<!-- scoped to parent div -->
<bod >
<div class="theme1">
<component1> </component1>
</div>
<div class="theme2">
<component1> </component1>
</div>
</body>
<!-- scoped to the component and mix and match -->
<bod class="theme1">
<div>
<component1> </component1>
</div>
<div>
<component1 class="theme2"> </component1>
</div>
</body>
so with above code, your component will have two different color side by side. you probably don't want to do mix and match, but I kept this here to show that the scope of variable is based on the parent/self element.
nebular is doing it more professionally but it's the whole idea
changeTheme().