Translate Color Name to ARGB Using PowerShell

ARGB stands for Alpha Red Green Blue and is something I use quite often when I work with a WPF and want to get a color for font or something else. Basically, if you want a color like Green, sometimes you have to use the ARGB type, which is #FF008000. Figuring out what this is can be annoying unless you have web access. Fortunately,  I wrote a simple function that can do this for me with little effort. While not everyone will find this useful, I figured I would post the code here along with some examples.

Function Get-ARGBColor {
    Param ([string[]]$Color)
    Begin {
        Add-Type –assemblyName PresentationFramework
    Process {
        If (-Not $PSBoundParameters['Color']) {
            $Color = [] | Get-Member -static -Type Property | Select -Expand Name        
        ForEach ($c in $color) {
            Try {
                $ARGB = []$c
                New-Object PSObject -Property @{
                    ARGB = "$([]::$c)"
                    Color = $c
            } Catch {
                Write-Warning "$c is not a valid color"
Get-ARGBColor -Color Green


Get-ARGBColor -Color Red,Yellow,Blue


If you just want to list out all available pre-defined colors, just run the command without any parameters.



This entry was posted in powershell and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s