I'm using PowerShell 5.1, and I want to store some colored text into a variable. I'm aware that you can use Write-Host to print out some colored strings into the console, as shown below:
However, I can't seem to save them into a variable:
I've tried various solutions such as the ones given here but nothing seems to work.


