File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,17 @@ $ColorTranslatorType = 'System.Drawing.ColorTranslator' -as [Type]
2525$ColorType = ' System.Drawing.Color' -as [Type ]
2626
2727function Get-VirtualTerminalSequence ($color , [int ]$offset = 0 ) {
28- if (($color -is [ConsoleColor ]) -and ($color -ge 0 ) -and ($color -le 15 )) {
29- return " ${AnsiEscape} $ ( $ConsoleColorToAnsi [$color ] + $offset ) m"
30- }
3128 if ($color -is [byte ]) {
3229 return " ${AnsiEscape} $ ( 38 + $offset ) ;5;${color} m"
3330 }
34- if ($ColorTranslatorType -and ( $ color -is [String ]) ) {
31+ if ($color -is [String ]) {
3532 try {
36- $color = $ColorTranslatorType ::FromHtml($color )
33+ if ($ColorTranslatorType ) {
34+ $color = $ColorTranslatorType ::FromHtml($color )
35+ }
36+ else {
37+ $color = [ConsoleColor ]$color
38+ }
3739 }
3840 catch {
3941 Write-Debug $_
@@ -42,6 +44,9 @@ function Get-VirtualTerminalSequence ($color, [int]$offset = 0) {
4244 if ($ColorType -and ($color -is $ColorType )) {
4345 return " ${AnsiEscape} $ ( 38 + $offset ) ;2;$ ( $color.R ) ;$ ( $color.G ) ;$ ( $color.B ) m"
4446 }
47+ if (($color -is [ConsoleColor ]) -and ($color -ge 0 ) -and ($color -le 15 )) {
48+ return " ${AnsiEscape} $ ( $ConsoleColorToAnsi [$color ] + $offset ) m"
49+ }
4550 return " ${AnsiEscape} $ ( $AnsiDefaultColor + $offset ) m"
4651}
4752
You can’t perform that action at this time.
0 commit comments