I am currently working on a progress bar that displays the percentage of delivery completed. While I have successfully designed the progress bar itself, I am struggling to change the text font color based on the background color of the bar.
<div class="progress">
<div class="bar" [style.width.%]="row[column?.value]">
</div>
<div class="percent-container">
<p class="percent">{{row[column?.value]}}%</p>
</div>
</div>
For example: https://i.sstatic.net/584VP.png
In the image above, the number '50' should be displayed in white while the percent symbol should be in black. When the background is completely blue, indicating 100%, the entire text should be displayed in white.
Although I am able to achieve an output similar to the first image, I am aiming to implement a feature where the font color changes based on the background color.
https://i.sstatic.net/MkCJw.png
The width of the progress bar will vary for each record in the table. Here is a sample CodePen link for reference: https://codepen.io/Surendra_Mourya/pen/NWdpMep