import { Component, OnInit, Input, Renderer2, ElementRef } from '@angular/core'; @Component({ selector: 'osd-template', templateUrl: './osd-template.component.html', styleUrls: ['./osd-template.component.scss'] }) export class OsdTemplateComponent implements OnInit { @Input() color: string = "rgb(42,100,250)" @Input() bgColor: string = "rgba(0,0,30,0.9)" @Input() font: string = "consolas, monospace" constructor(private renderer: Renderer2, private el: ElementRef) { } ngOnInit() { this.renderer.setStyle(this.el.nativeElement.firstElementChild, 'color', this.color) this.renderer.setStyle(this.el.nativeElement.firstElementChild, 'backgroundColor', this.bgColor) this.renderer.setStyle(this.el.nativeElement.firstElementChild, 'font-family', this.font) } }