{"id":8853,"date":"2022-02-11T14:20:35","date_gmt":"2022-02-11T19:20:35","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8853"},"modified":"2022-02-11T14:20:38","modified_gmt":"2022-02-11T19:20:38","slug":"friday-fun-painting-a-pretty-picture-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","title":{"rendered":"Friday Fun &#8211; Painting a Pretty Picture with PowerShell"},"content":{"rendered":"\n<p>A few months ago, I wrote about my PSClock module. This is a set of PowerShell commands for creating a digital clock using a transparent WPF form. You can install the module from the PowerShell Gallery. The repository can be found at<a href=\"https:\/\/github.com\/jdhitsolutions\/PSClock\" target=\"_blank\" rel=\"noreferrer noopener\"> https:\/\/github.com\/jdhitsolutions\/PSClock<\/a>. Because my Windows wallpaper changes throughout the day, sometimes I need to change the clock color to make it easier to read. The challenge is that the color options come from [System.Drawing.Color]. I can use values like PapayaWhip, Cornsilk, and Moccasin. But what do those colors look like? Let's have some fun and figure it out.<\/p>\n\n\n\n<p>The first step, which is more of a safety net than anything, is to make sure I can use [System.Drawing.Color] in my PowerShell session. I'll use Add-Type to load the assembly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Try {\n    Add-Type -AssemblyName system.drawing -ErrorAction Stop\n}\nCatch {\n    Throw \"These functions require the [System.Drawing.Color] .NET Class\"\n}<\/code><\/pre>\n\n\n\n<p>As far as I know, PowerShell has no way of directly rendering a color value from this class. However, PowerShell can, in fact, render color using ANSI escape sequences, but not in the PowerShell ISE. We'll head in that direction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"getting-color-values\">Getting Color Values<\/h2>\n\n\n\n<p>I can get a color directly from the class using syntax like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png\"><img loading=\"lazy\" decoding=\"async\" width=\"373\" height=\"194\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png\" alt=\"a system.drawing.color\" class=\"wp-image-8855\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png 373w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse-300x156.png 300w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><\/a><\/figure>\n\n\n\n<p>The properties R, G, and B are the Red, Green, and Blue values. I'll need those in a moment\u2014first, a few quick words about this class. <\/p>\n\n\n\n<p>How did I know the color name? I asked PowerShell using PSReadline.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/using-psreadline.png\"><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"62\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/using-psreadline.png\" alt=\"using psreadline\" class=\"wp-image-8856\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/using-psreadline.png 332w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/using-psreadline-300x56.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/a><\/figure>\n\n\n\n<p>After the :: operator, I press Ctrl+Space and answer y when prompted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames.png\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames.png\" alt=\"all system.drawing.color names\" class=\"wp-image-8857\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames.png 979w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames-300x157.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames-768x402.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/colornames-850x445.png 850w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/figure>\n\n\n\n<p>The \"gotcha\" for those familiar with working with .NET classes is that this is NOT an enumeration. You cannot use code like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[enum]::GetNames([System.ConsoleColor])<\/code><\/pre>\n\n\n\n<p>But,  I can use the GetProperties() method, select the Name property and filter out properties that don't match color names.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[system.drawing.color].GetProperties().name | Where-Object { $_ -notmatch \"^\\bIs|Name|[RGBA]\\b\" }<\/code><\/pre>\n\n\n\n<p>Once I know the name, I can get the value I did above or use the FromName() method.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/FromName.png\"><img loading=\"lazy\" decoding=\"async\" width=\"463\" height=\"203\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/FromName.png\" alt=\"\" class=\"wp-image-8859\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/FromName.png 463w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/FromName-300x132.png 300w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"converting-to-ansi\">Converting to ANSI<\/h2>\n\n\n\n<p>As I mentioned earlier, if I have RBG values, I can construct a 256-color ANSI escape sequence. The easiest way is to use the FromRGB() method on $PSStyle.Foreground in PowerShell 7.2.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$psstyle.Foreground.fromrgb(127,255,0)<\/code><\/pre>\n\n\n\n<p>Or you can use the actual ANSI sequence.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">\"$([char]27)[38;2;{0};{1};{2}m\" -f 127,255,0<\/code><\/pre>\n\n\n\n<p>If you try this using the Chartreuse RBG values, you won't see anything other than maybe part of your prompt changing color. That's because this is only the opening part of a sequence. To use it, build a string like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#PS 7.2\n$ansi = $PSStyle.Foreground.FromRgb(127,255,0)\n\"$($ansi)Chartreuse$($psstyle.Reset)\"\n\n#Other\n$ansi = \"$([char]27)[38;2;{0};{1};{2}m\" -f 127,255,0\n\"$($ansi)Chartreuse$([char]27)[0m\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/formatted-sample.png\"><img loading=\"lazy\" decoding=\"async\" width=\"538\" height=\"154\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/formatted-sample.png\" alt=\"ANSI formatted sample\" class=\"wp-image-8860\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/formatted-sample.png 538w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/formatted-sample-300x86.png 300w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toolmaking\">Toolmaking<\/h2>\n\n\n\n<p>At this point, I should have all the pieces I need. I can get the RGB values of the [System.Drawing.Color. I can use those values to create the ANSI sequence. Finally, I can build a sample string.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$name = \"Turquoise\"\n$color = [System.Drawing.Color]::FromName($Name)\n$ansi = $PSStyle.Foreground.FromRgb($color.R,$color.G,$color.B)\n\"$($ansi)$Name$($psstyle.Reset)\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/sample-steps.png\"><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"106\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/sample-steps.png\" alt=\"conversion steps\" class=\"wp-image-8861\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/sample-steps.png 611w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/sample-steps-300x52.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/a><\/figure>\n\n\n\n<p>You can almost see PowerShell functions writing themselves. I could have built a monolithic function to do everything, but I decided to break this down to a more granular level. Having separate functions makes them easy to re-use. It also makes them easier to Pester test. Especially because I'm invoking several .NET methods that you can't properly mock. But, I can mock a function like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">function Get-RGB {\n    [cmdletbinding()]\n    [OutputType(\"RGB\")]\n    Param(\n        [Parameter(Mandatory, HelpMessage = \"Enter the name of a system color like Tomato\")]\n        [ValidateNotNullOrEmpty()]\n        [string]$Name\n    )\n    Try {\n        $Color = [System.Drawing.Color]::FromName($Name)\n        [PSCustomObject]@{\n            PSTypeName = \"RGB\"\n            Name       = $Name\n            Red        = $color.R\n            Green      = $color.G\n            Blue       = $color.B\n        }\n    }\n    Catch {\n        Throw $_\n    }\n}<\/code><\/pre>\n\n\n\n<p>The function writes a simple object to the pipeline. I can use that output to create the ANSI sequence.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">function Convert-RGBtoAnsi {\n    #This will write an opening ANSI escape sequence to the pipeline\n    [cmdletbinding()]\n    [OutputType(\"String\")]\n    Param(\n        [parameter(Position = 0, ValueFromPipelineByPropertyName)]\n        [int]$Red,\n        [parameter(Position = 1, ValueFromPipelineByPropertyName)]\n        [int]$Green,\n        [parameter(Position = 2, ValueFromPipelineByPropertyName)]\n        [int]$Blue\n    )\n    Process {\n        &lt;#\n        For legacy powershell session you could create a string like this:\n        \"$([char]27)[38;2;{0};{1};{2}m\" -f $red,$green,$blue\n        #>\n        $psstyle.Foreground.FromRgb($Red, $Green, $Blue)\n    }\n}<\/code><\/pre>\n\n\n\n<p>You'll notice that the parameters are defined with the same names as the RGB object and take pipeline input. That's because I knew I would want to run a command like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$name =\"DeepSkyBlue\"\n$ansi = Get-RGB $name | Convert-RGBtoAnsi\n\"$($ansi)$Name$($psstyle.Reset)\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/converting-colors.png\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"113\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/converting-colors.png\" alt=\"\" class=\"wp-image-8862\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/converting-colors.png 448w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/converting-colors-300x76.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/a><\/figure>\n\n\n\n<p>The last command makes it even easier to run these commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Function Get-DrawingColor {\n    [cmdletbinding()]\n    [alias(\"gdc\")]\n    [OutputType(\"PSColorSample\")]\n    Param(\n        [Parameter(Position = 0, HelpMessage = \"Specify a color by name. Wildcards are allowed.\")]\n        [ValidateNotNullOrEmpty()]\n        [string[]]$Name\n    )\n\n    Write-Verbose \"Starting $($MyInvocation.MyCommand)\"\n\n    if ($PSBoundParameters.ContainsKey(\"Name\")) {\n        if ($Name[0] -match \"\\*\") {\n            Write-Verbose \"Finding drawing color names that match $name\"\n            $colors = [system.drawing.color].GetProperties().name | Where-Object { $_ -like $name[0] }\n        }\n        else {\n            $colors = @()\n            foreach ($n in $name) {\n                if ($n -as [system.drawing.color]) {\n                    $colors += $n\n                }\n                else {\n                    Write-Warning \"The name $n does not appear to be a valid System.Drawing.Color value. Skipping this name.\"\n                }\n                Write-Verbose \"Using parameter values: $($colors -join ',')\"\n\n            } #foreach name\n        } #else\n    } #if PSBoundParameters contains Name\n    else {\n        Write-Verbose \"Geting all drawing color names\"\n        $colors = [system.drawing.color].GetProperties().name | Where-Object { $_ -notmatch \"^\\bIs|Name|[RGBA]\\b\" }\n    }\n    Write-Verbose \"Processing $($colors.count) colors\"\n    if ($colors.count -gt 0) {\n        foreach ($c in $colors) {\n            Write-Verbose \"...$c\"\n            $ansi = Get-RGB $c -OutVariable rgb | Convert-RGBtoAnsi\n            #display an ANSI formatted sample string\n            $sample = \"$ansi$c$($psstyle.reset)\"\n\n            #write a custom object to the pipeline\n            [PSCustomObject]@{\n                PSTypeName = \"PSColorSample\"\n                Name       = $c\n                RGB        = $rgb\n                ANSIString = $ansi.replace(\"`e\", \"``e\")\n                ANSI       = $ansi\n                Sample     = $sample\n            }\n        }\n    } #if colors.count > 0\n    else {\n        Write-Warning \"No valid colors found.\"\n    }\n    Write-Verbose \"Ending $($MyInvocation.MyCommand)\"\n}<\/code><\/pre>\n\n\n\n<p>I can specify a color by name.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/get-drawingcolor.png\"><img loading=\"lazy\" decoding=\"async\" width=\"501\" height=\"162\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/get-drawingcolor.png\" alt=\"\" class=\"wp-image-8863\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/get-drawingcolor.png 501w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/get-drawingcolor-300x97.png 300w\" sizes=\"auto, (max-width: 501px) 100vw, 501px\" \/><\/a><\/figure>\n\n\n\n<p>I don't know all the ways I might use this output yet, so I'm creating a rich object. There is a value for the ANSI property, but it doesn't display because it is the actual ANSI sequence. That's why I include an ANSIString property that shows the value as a string I could use in a script.<\/p>\n\n\n\n<p>The default behavior is to display everything.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors.png\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors.png\" alt=\"all color samples\" class=\"wp-image-8864\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors.png 979w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-300x157.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-768x402.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-850x445.png 850w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/figure>\n\n\n\n<p>Not every color displays using ANSI, and your background color may also affect the display, but this is close enough for my work. By the way, the function accepts wildcards.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/light-colors.png\"><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"395\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/light-colors.png\" alt=\"light colors\" class=\"wp-image-8865\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/light-colors.png 809w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/light-colors-300x146.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/light-colors-768x375.png 768w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a><\/figure>\n\n\n\n<p>This screenshot is from VS Code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"custom-formatting\">Custom Formatting<\/h2>\n\n\n\n<p>You probably noticed that I often used Format-Table to get better-looking output. In fact, I might like an output that only shows me the sample.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-wide-color.png\"><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"153\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-wide-color.png\" alt=\"\" class=\"wp-image-8866\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-wide-color.png 611w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-wide-color-300x75.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/a><\/figure>\n\n\n\n<p>But let's make this easy. I created a format ps1xml file for the custom object from Get-DrawingColor. If you go back to the code, you'll see that I am assigning a type name. This allows me to create the file.<\/p>\n\n\n\n<pre title=\"PSColorSample.Format.ps1xml\" class=\"wp-block-code\"><code lang=\"xml\" class=\"language-xml\">&lt;!--\nFormat type data generated 02\/08\/2022 17:32:56 by PROSPERO\\Jeff\n\nThis file was created using the New-PSFormatXML command that is part\nof the PSScriptTools module.\n\nhttps:\/\/github.com\/jdhitsolutions\/PSScriptTools\n-->\n&lt;Configuration>\n  &lt;ViewDefinitions>\n    &lt;View>\n      &lt;!--Created 02\/08\/2022 17:32:56 by PROSPERO\\Jeff-->\n      &lt;Name>default&lt;\/Name>\n      &lt;ViewSelectedBy>\n        &lt;TypeName>PSColorSample&lt;\/TypeName>\n      &lt;\/ViewSelectedBy>\n      &lt;WideControl>\n        &lt;!--Delete the AutoSize node if you want to use PowerShell defaults.\n        &lt;AutoSize \/>-->\n        &lt;WideEntries>\n          &lt;WideEntry>\n            &lt;WideItem>\n              &lt;PropertyName>Sample&lt;\/PropertyName>\n            &lt;\/WideItem>\n          &lt;\/WideEntry>\n        &lt;\/WideEntries>\n      &lt;\/WideControl>\n    &lt;\/View>\n    &lt;View>\n      &lt;!--Created 02\/08\/2022 17:35:40 by PROSPERO\\Jeff-->\n      &lt;Name>default&lt;\/Name>\n      &lt;ViewSelectedBy>\n        &lt;TypeName>PSColorSample&lt;\/TypeName>\n      &lt;\/ViewSelectedBy>\n      &lt;TableControl>\n        &lt;!--Delete the AutoSize node if you want to use the defined widths.-->\n        &lt;AutoSize \/>\n        &lt;TableHeaders>\n          &lt;TableColumnHeader>\n            &lt;Label>Name&lt;\/Label>\n            &lt;Width>14&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>RGB&lt;\/Label>\n            &lt;Width>31&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>ANSIString&lt;\/Label>\n            &lt;Width>22&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n          &lt;TableColumnHeader>\n            &lt;Label>Sample&lt;\/Label>\n            &lt;Width>37&lt;\/Width>\n            &lt;Alignment>left&lt;\/Alignment>\n          &lt;\/TableColumnHeader>\n        &lt;\/TableHeaders>\n        &lt;TableRowEntries>\n          &lt;TableRowEntry>\n            &lt;TableColumnItems>\n              &lt;!--\n            By default the entries use property names, but you can replace them with scriptblocks.\n            &lt;ScriptBlock>$_.foo \/1mb -as [int]&lt;\/ScriptBlock>\n-->\n              &lt;TableColumnItem>\n                &lt;PropertyName>Name&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>RGB&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>ANSIString&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n              &lt;TableColumnItem>\n                &lt;PropertyName>Sample&lt;\/PropertyName>\n              &lt;\/TableColumnItem>\n            &lt;\/TableColumnItems>\n          &lt;\/TableRowEntry>\n        &lt;\/TableRowEntries>\n      &lt;\/TableControl>\n    &lt;\/View>\n  &lt;\/ViewDefinitions>\n&lt;\/Configuration><\/code><\/pre>\n\n\n\n<p>In the script file that contains all of the functions, I add this line to load the formatting file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Update-FormatData $PSScriptRoot\\pscolorsample.format.ps1xml<\/code><\/pre>\n\n\n\n<p>I made the wide layout the default.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format.png\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format.png\" alt=\"colors formatted wide\" class=\"wp-image-8867\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format.png 979w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format-300x157.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format-768x402.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/wide-color-format-850x445.png 850w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/figure>\n\n\n\n<p>I also created a custom table view that omits the ANSI property since there's nothing to see.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"512\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png\" alt=\"colors formatted table\" class=\"wp-image-8868\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png 979w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors-300x157.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors-768x402.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors-850x445.png 850w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"summary\">Summary<\/h2>\n\n\n\n<p>I'll admit you may not have a compelling need for these functions. But I hope you followed my development process. Think about how your functions might work together. Write rich objects to the pipeline and use formatting files to provide default output. <\/p>\n\n\n\n<p>Have a great weekend.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few months ago, I wrote about my PSClock module. This is a set of PowerShell commands for creating a digital clock using a transparent WPF form. You can install the module from the PowerShell Gallery. The repository can be found at https:\/\/github.com\/jdhitsolutions\/PSClock. Because my Windows wallpaper changes throughout the day, sometimes I need to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New Friday Fun: Converting System.Drawing.Color to ANSI. #PowerShell #PS7Now","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[271,4,8],"tags":[628,568,534,664,540],"class_list":["post-8853","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell","category-scripting","tag-ansi","tag-friday-fun","tag-powershell","tag-psstyle","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-11T19:20:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-11T19:20:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun &#8211; Painting a Pretty Picture with PowerShell\",\"datePublished\":\"2022-02-11T19:20:35+00:00\",\"dateModified\":\"2022-02-11T19:20:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/\"},\"wordCount\":850,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/chartreuse.png\",\"keywords\":[\"ANSI\",\"Friday Fun\",\"PowerShell\",\"PSStyle\",\"Scripting\"],\"articleSection\":[\"Friday Fun\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/\",\"name\":\"Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/chartreuse.png\",\"datePublished\":\"2022-02-11T19:20:35+00:00\",\"dateModified\":\"2022-02-11T19:20:38+00:00\",\"description\":\"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/chartreuse.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/chartreuse.png\",\"width\":373,\"height\":194},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8853\\\/friday-fun-painting-a-pretty-picture-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun &#8211; Painting a Pretty Picture with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator","description":"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator","og_description":"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2022-02-11T19:20:35+00:00","article_modified_time":"2022-02-11T19:20:38+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun &#8211; Painting a Pretty Picture with PowerShell","datePublished":"2022-02-11T19:20:35+00:00","dateModified":"2022-02-11T19:20:38+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/"},"wordCount":850,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png","keywords":["ANSI","Friday Fun","PowerShell","PSStyle","Scripting"],"articleSection":["Friday Fun","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","name":"Friday Fun - Painting a Pretty Picture with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png","datePublished":"2022-02-11T19:20:35+00:00","dateModified":"2022-02-11T19:20:38+00:00","description":"See how I build some PowerShell tools to display System.Drawing.Color values in my PowerShell session using ANSI escape sequences.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/chartreuse.png","width":373,"height":194},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Friday Fun &#8211; Painting a Pretty Picture with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":8871,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8871\/more-colorful-fun-with-powershell\/","url_meta":{"origin":8853,"position":0},"title":"More Colorful Fun with PowerShell","author":"Jeffery Hicks","date":"February 14, 2022","format":false,"excerpt":"In my last Friday Fun post, I shared some PowerShell code for displaying [System.Drawing.Color] values from a console using ANSI escape sequences. After I published the article, I realized what I really wanted was a color palette display that wouldn't be affected by the console background. A Windows Presentation Foundation\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/textbox-background.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/textbox-background.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/textbox-background.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/textbox-background.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8877,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8877\/even-more-colorful-fun-with-powershell-and-wpf\/","url_meta":{"origin":8853,"position":1},"title":"Even More Colorful Fun with PowerShell and WPF","author":"Jeffery Hicks","date":"February 16, 2022","format":false,"excerpt":"Let's continue looking at how to use PowerShell and a Windows Presentation Foundation (WPF) form to display [System.Drawing.Color] values. This article builds on an earlier post so if you missed it, take a few minutes to get caught up. As I did earlier, before running any WPF code in PowerShell,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/all-colors-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4169,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4169\/friday-fun-updated-ise-scripting-geek-module\/","url_meta":{"origin":8853,"position":2},"title":"Friday Fun: Updated ISE Scripting Geek Module","author":"Jeffery Hicks","date":"January 9, 2015","format":false,"excerpt":"A few years ago I published a module with a number of functions and enhancements for the PowerShell ISE. This ISEScriptingGeek module has remained popular over the last few years. But I wrote it for PowerShell v2. I have also come up with a number of new additions to the\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"geek","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/01\/geek-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4061,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4061\/friday-fun-lets-play-a-game\/","url_meta":{"origin":8853,"position":3},"title":"Friday Fun &#8211; Let&#8217;s Play a Game","author":"Jeffery Hicks","date":"October 3, 2014","format":false,"excerpt":"Today is going to be a lot of fun. A few years ago, back when we were still running PowerShell 2.0 everywhere, I created a module to run a Bingo game in a PowerShell session. I primarily wrote the module as a learning tool for beginners wanting to know more\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"BingoCard-small","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/10\/BingoCard-small.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4155,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4155\/friday-fun-another-christmas-prompt\/","url_meta":{"origin":8853,"position":4},"title":"Friday Fun: Another Christmas Prompt","author":"Jeffery Hicks","date":"December 12, 2014","format":false,"excerpt":"In last week's Friday Fun post, I shared with you a PowerShell prompt that would display a festive Christmas countdown clock. This week I have another holiday related prompt function. This one is pretty straight forward and is not that much different from the default PowerShell prompt function. Function Prompt\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"christmastree","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/12\/christmastree.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4923,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-ise\/4923\/friday-fun-tweaking-the-powershell-ise\/","url_meta":{"origin":8853,"position":5},"title":"Friday Fun: Tweaking the PowerShell ISE","author":"Jeffery Hicks","date":"February 19, 2016","format":false,"excerpt":"Today's fun is still PowerShell related, but instead of something in the console, we'll have some fun with the PowerShell ISE. One of the things I love about the PowerShell ISE is that you can customize it and extend it.\u00a0 My ISE Scripting Geek project is an example.\u00a0 But today\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-12.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8853"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8853\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}