-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
Description
Describe the change
Green if above 4h
Yellow if between 1 and 4 hours
Orange between 0 and 1 hour,
else
red
function Get-ColoredText {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[double]$MaxValue,
[Parameter(Mandatory)]
[double]$Value,
[Parameter(Mandatory)]
[string]$Text
)
$ratio = [Math]::Min(($Value / $MaxValue), 1)
# Calculate RGB color based on ratio (Green -> Yellow -> Orange -> Red)
if ($ratio -le 0.5) {
# Green to Yellow
$r = [Math]::Round(255 * (2 * $ratio))
$g = 255
}
else {
# Yellow to Red
$r = 255
$g = [Math]::Round(255 * (2 - 2 * $ratio))
}
$b = 0
$color = $PSStyle.Foreground.FromRgb($r, $g, $b)
# Output colored text
"$color$Text$($PSStyle.Reset)"
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Activity
GitHubContext
#449