function Format-BoldText { <# .SYNOPSIS Get text formatted for bold if the system supports it. .PARAMETER Text The text to apply formatting to. #> [CmdletBinding()] [OutputType([string])] param ( [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] [string]$Text ) if (Test-TerminalSupportsANSIEscapes) { return "$($PSStyle.Bold)$Text$($PSStyle.BoldOff)" } else { return $Text } }