I'm confused on how to change the color of the text without using Write-Host and the color should be change in the HTML output.
$overallStatus = ''
if(($isDBConnected.Equals('Connected Successfully')) -and ($isCMConnected.Equals('Connected Successfully'))){
$overallStatus = 'GREEN'
}
else{
$overallStatus = 'Red'
$overallStatus
}
and this is my composition for html
for($a=0; $a -le $notiftemplate.Length; $a ){
switch -Regex ($notiftemplate[$a]){
"\[status\]"{
$notiftemplate[$a] = $notiftemplate[$a] -replace "\[status\]",$overallStatus
break;
}
}
I'm trying to add this on first code
$overallStatus = @{"<td style='padding-left:5pt;'> <b> [status] </b></td>"}
but it's not working.
CodePudding user response:
Try this if your code have the right syntax and you don't use tables in html and there is no more code because of the TD tag:
$overallStatus = @"<span style='padding-left:5pt;color:green;font-weight:bold;'> GREEN </span>"@
or
$overallStatus = '<span style="color:green;">GREEN</span>'
If there is more code for the table, because of the td tag use:
$overallStatus = @"<td style='padding-left:5pt;color:green;font-weight:bold;'> GREEN </td>"@