ps/Modules/Cole.PowerShell.Developer/Public/Format-BoldText.ps1

21 lines
469 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
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
}
}