Skip to content

Format-SpectrePanel

Synopsis

Formats a string as a Spectre Console panel with optional title, border, and color. Spectre panel example


Description

This function takes a string and formats it as a Spectre Console panel with optional title, border, and color. The resulting panel can be displayed in the console using the Write-Host command.


Examples

This example displays a panel with the title “My Panel”, a rounded border, and a red border color.

Format-SpectrePanel -Data "Hello, world!" -Title "My Panel" -Border "Rounded" -Color "Red"

Parameters

Data

The string to be formatted as a panel.

TypeRequiredPositionPipelineInput
[String]true1true (ByValue)

Title

The title to be displayed at the top of the panel.

TypeRequiredPositionPipelineInput
[String]false2false

Border

The type of border to be displayed around the panel.

Valid Values:

  • Ascii
  • Double
  • Heavy
  • None
  • Rounded
  • Square
TypeRequiredPositionPipelineInput
[String]false3false

Expand

Switch parameter that specifies whether the panel should be expanded to fill the available space.

TypeRequiredPositionPipelineInput
[Switch]falsenamedfalse

Color

The color of the panel border.

TypeRequiredPositionPipelineInput
[String]false4false

Width

The width of the panel.

TypeRequiredPositionPipelineInput
[Int32]false5false

Height

The height of the panel.

TypeRequiredPositionPipelineInput
[Int32]false6false

Syntax

Format-SpectrePanel [-Data] <String> [[-Title] <String>] [[-Border] <String>] [-Expand] [[-Color] <String>] [[-Width] <Int32>] [[-Height] <Int32>] [<CommonParameters>]