Create a Text object with specified background and foreground colors
New-Text [-Object] <Object> [-BackgroundColor <RgbColor>] [-Separator <Object>] [-ForegroundColor <RgbColor>] [-LeaveColor] [-IgnoreEntities]
Create a Text object with specified background and foreground colors, and rendering HTML-style entities. When this object is rendered to the host with .ToString(), it inserts ANSI Virtual Terminal escape sequences for the specified colors, and by default, outputs escape sequences to clear those colors after the text.
PS C:\> New-Text "♥" -ForegroundColor Red
BackgroundColor ForegroundColor Object ToString
--------------- --------------- ------ --------
`e[101m `e[0m Red ♥`e[0m `e[91m?`e[39m`e[0m
Generates a text object with the hearts symbol (♥) in red. The output will show the BackgroundColor, ForegroundColor, Text (with the entity text in it) and the rendered output of .ToString()
where the entity will be replaced with the hearts symbol.
PS C:\> "I $(New-Text "♥" -ForegroundColor "#F00") PS"
I `e[38;2;255;0;0m?`e[39m PS
Outputs the text "I ♥ PS" with the heart in red.
The background color. You may specify it as CSS hex "#RRGGBB" (or just "RRGGBB") or as an XTerm index "xt123" (or just "123") or as a ConsoleColor like "Red" or "DarkRed"...
Type: RgbColor
Parameter Sets: (All)
Aliases: Bg
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The foreground color. You may specify it as CSS hex "#RRGGBB" (or just "RRGGBB") or as an XTerm index "xt123" (or just "123") or as a ConsoleColor like "Red" or "DarkRed"...
Type: RgbColor
Parameter Sets: (All)
Aliases: Fg
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
If set, don't render the HTML Entities to characters (i.e. leave "♥" as "♥" instead of as "♥")
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
If set, don't clear the colors at the end of the output.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies objects to display in the host.
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue, FromRemainingArguments)
Accept wildcard characters: False
Specifies a separator string to the output between objects displayed on the console.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False