external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Convert an HTML color code to ANSI.
Convert-HtmlToAnsi [-HtmlCode] <String> [<CommonParameters>]
This simple function is designed to convert an HTML color code like #ff5733 into an ANSI escape sequence. To use the resulting value you still need to construct an ANSI string with the escape character and the closing [0m.
PS C:\> Convert-HtmlToAnsi "#ff5733"
[38;2;255;87;51m
PS C:\> "Running processes: `e$(cha "#ff337d")$((Get-Process).count)`e[0m"
Running processes: 306
The number of processes will be displayed in color. This example is using the cha alias for Convert-HtmlToAnsi.
Specify an HTML color code like #13A10E. You need to include the # character.
Type: String
Parameter Sets: (All)
Aliases: code
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/