I have an object with a set of information, including color. I intend this color to be implemented as a background-color with opacity and as a text color (without opacity to look different).
Does anyone know how I can make it so that through the color of the object / variable, I can add opacity?
.ts
color: string = "green";
name:string = "ABC";
id: number = 1;
.html
<div style="display: flex; flex-direction: column; width: 60%;">
<span [style.background-color]="color" [style.color]="color" class="cc">{{name}}</span>
<span [style.background-color]="color" class="mb" [style.color]="color">{{id}}</span>
</div>
Problem
I want the background-color to have opacity so that the text is visible. I intend to achieve this, without having to create a variable with a "different" color.
