@@ -9,19 +9,26 @@ function Draw-AsciiBanner {
99 $maxLen = ($Lines | Measure-Object Length - Maximum).Maximum
1010 $contentWidth = $maxLen + ($ExtraPadding * 2 )
1111
12- # Top and bottom borders
13- $top = " ╭" + (" ─" * ($contentWidth + 2 )) + " ╮"
14- $bottom = " ╰" + (" ─" * ($contentWidth + 2 )) + " ╯"
12+ # Top and bottom borders - use Unicode code points for PS 5.1 compatibility
13+ $topLeft = [char ]0x256D # ╭
14+ $topRight = [char ]0x256E # ╮
15+ $bottomLeft = [char ]0x2570 # ╰
16+ $bottomRight = [char ]0x256F # ╯
17+ $horizontal = [char ]0x2500 # ─
18+ $vertical = [char ]0x2502 # │
19+
20+ $top = $topLeft + ($horizontal.ToString () * ($contentWidth + 2 )) + $topRight
21+ $bottom = $bottomLeft + ($horizontal.ToString () * ($contentWidth + 2 )) + $bottomRight
1522
1623 Write-Host $top - ForegroundColor $BorderColor
1724 foreach ($line in $Lines ) {
1825 $totalPadding = $contentWidth - $line.Length
1926 $leftPad = [math ]::Floor($totalPadding / 2 )
2027 $rightPad = $totalPadding - $leftPad
21- $padded = (" " * $leftPad ) + $line + (" " * $rightPad )
22- Write-Host " │ " - NoNewline - ForegroundColor $BorderColor
28+ $padded = (' ' * $leftPad ) + $line + (' ' * $rightPad )
29+ Write-Host " $vertical " - NoNewline - ForegroundColor $BorderColor
2330 Write-Host $padded - NoNewline - ForegroundColor $TextColor
24- Write-Host " │ " - ForegroundColor $BorderColor
31+ Write-Host " $vertical " - ForegroundColor $BorderColor
2532 }
2633 Write-Host $bottom - ForegroundColor $BorderColor
2734}
0 commit comments