This is just an example implementation - there might be easier / better way to do this, but it should be a good starting point for you.
First, grab the reference to some element on your template:
@ViewChild('someDivElement', {static: true}) stylesContainer: ElementRef;
Then, each time you need to recalculate styles you can do something like this:
private changeStyles(): void {
const styleContent = this.getSomeStyleContent(); // This should be a string value of what you would put inside the <style> element.
// Get the native element from the container reference
const placeholderElement: HTMLDivElement = this.stylesContainer.nativeElement;
// If there is already element in it, remove it. If you need something else than styles in that component,
// query the item differently, e.g. by type.
if (placeholderElement.firstChild) {
placeholderElement.removeChild(placeholderElement.firstChild);
}
// Add your styles inside the placeholder.
placeholderElement.insertAdjacentHTML('afterbegin', `<style>${styles}</style>`);
}
Note that this is NOT encapsulated, meaning it will affect html on whole site, not only within that component. Also note that it will force a reflow (or two if there were previous styles) but there's not much we can about it.