Skip to content

Commit

Permalink
Add zero prefix to individual rgb values so length of each value is a…
Browse files Browse the repository at this point in the history
…lways 2
  • Loading branch information
schmjop authored May 13, 2024
1 parent 46866e4 commit a8d8406
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Terminal-Icons/Private/ConvertFrom-ColorEscapeSequence.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function ConvertFrom-ColorEscapeSequence {
$g = '{0:x}' -f [int]$arr[3]
$b = '{0:x}' -f [int]$arr[4].TrimEnd('m')

if ($r.Length -eq 1) { $r = '0'+$r }
if ($g.Length -eq 1) { $g = '0'+$g }
if ($b.Length -eq 1) { $b = '0'+$b }

($r + $g + $b).ToUpper()
}
}

0 comments on commit a8d8406

Please sign in to comment.