{"id":7479,"date":"2020-05-15T14:45:39","date_gmt":"2020-05-15T18:45:39","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7479"},"modified":"2020-05-18T10:33:15","modified_gmt":"2020-05-18T14:33:15","slug":"friday-fun-with-powershell-and-ansi","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/","title":{"rendered":"Friday Fun with PowerShell and ANSI"},"content":{"rendered":"<p>Ever since PowerShell 7 came along, I've been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run <code>Get-PSReadlineOption<\/code> to see what I'm talking about.<\/p>\n<p>Today I have 2 quick \"toys\" for you to play with. The first is a way to see how to create 256 color schemes. I pulled the data from <a href=\"https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/en.wikipedia.org\/wiki\/ANSI_escape_code<\/a>. Basically, you can define an escape sequence using the form <code><esc>[38;5;Nm<TEXT><esc>[0m<\/code>. The <code><esc><\/code> value will be <code>$([char]0x1b)<\/code> for Windows PowerShell. You can use the same in PowerShell 7 or the much easier <code>`e<\/code>.\u00a0 The 38 indicates you want to color the foreground. Use 48 to set the background. And <code>N<\/code> is a value between 1 and 255.<\/p>\n<p>Here's a short script you can run to see what the color schemes look like.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Param ([switch]$Background)\n\nif ($host.name -match \"ISE\") {\n    return \"This script won't work properly in the PowerShell ISE. Run it in a PowerShell console.\"\n}\n\nif ($Background) {\n    $X = 48\n}\nelse {\n    $X = 38\n}\n\nif ($iscoreclr) {\n    $esc = \"`e\"\n    $escText = '`e'\n}\nelse {\n    $esc = $([char]0x1b)\n    $escText = '$([char]0x1b)'\n}\n\nClear-Host\n\n1..255| ForEach-Object {\n    $text = \"{0}[$X;5;{1}m'Sample Text'{0}[0m\" -f $escText,$_\n\n    \"{0}`t{1}\" -f $text,(\"$esc[$X;5;$($_)m$('Sample Text')$esc[0m\")\n}\n<\/pre>\n<p>Here's a sample running in Windows PowerShell.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7480\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png\" alt=\"ansi256-fg\" width=\"1093\" height=\"682\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png 1093w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg-300x187.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg-1024x639.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg-768x479.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg-850x530.png 850w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/p>\n<p>Here's a sample of the backgrounds.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7481\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-bg.png\" alt=\"ansi256-bg\" width=\"898\" height=\"728\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-bg.png 898w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-bg-300x243.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-bg-768x623.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-bg-850x689.png 850w\" sizes=\"auto, (max-width: 898px) 100vw, 898px\" \/><\/p>\n<p>You might want to use one of these values to update color options using Set-PSReadlneOption.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7482\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline.png\" alt=\"ans256-psreadline\" width=\"1186\" height=\"538\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline.png 1186w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline-300x136.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline-1024x465.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline-768x348.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ans256-psreadline-850x386.png 850w\" sizes=\"auto, (max-width: 1186px) 100vw, 1186px\" \/>Here you can see that the Parameter color is too difficult to read. I update it with a brighter color and now it is much easier to read. I would need to put this command in my PowerShell profile.<\/p>\n<p>The other fun I've been having is creating color gradient bars.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7483\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-1.png\" alt=\"ansibar-1\" width=\"837\" height=\"353\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-1.png 837w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-1-300x127.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-1-768x324.png 768w\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" \/><\/p>\n<p>Here's a simple function you can use.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Function New-ANSIBar {\n    [cmdletbinding()]\n    Param(\n        [Parameter(Mandatory,HelpMessage= \"Enter a range of 256 color values, e.g. (232..255)\")]\n        [ValidateNotNullOrEmpty()]\n        [int[]]$Range,\n        [Parameter(HelpMessage = \"How many spaces do you want in the bar? This will increase the length of the bar.\")]\n        [int]$Spacing = 1\n    )\n    $esc = \"$([char]0x1b)\"\n    $out = @()\n    $blank = \" \"*$spacing\n    $out += $range | ForEach-Object {\n        \"$esc[48;5;$($_)m$($blank)$esc[0m\"\n    }\n\n    $out += $range | Sort-Object -Descending | ForEach-Object {\n        \"$esc[48;5;$($_)m$($blank)$esc[0m\"\n    }\n    $out -join \"\"\n}\n<\/pre>\n<p>Specify a range or collection of 256 color values and the function will create the gradient bar. If you want a longer bar, increase the spacing.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7484\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png\" alt=\"ansibar-2\" width=\"1091\" height=\"227\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2.png 1091w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2-300x62.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2-1024x213.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2-768x160.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansibar-2-850x177.png 850w\" sizes=\"auto, (max-width: 1091px) 100vw, 1091px\" \/><\/p>\n<p>You might use this to add a little eye candy to your PowerShell profile, or merely to avoid having to do real work!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever since PowerShell 7 came along, I&#8217;ve been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run Get-PSReadlineOption to see what I&#8217;m talking about. Today I have 2 quick&#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 with #PowerShell and ANSI","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":[4],"tags":[628,534,540],"class_list":["post-7479","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-ansi","tag-powershell","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 with PowerShell and ANSI &#8226; The Lonely Administrator<\/title>\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\/7479\/friday-fun-with-powershell-and-ansi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun with PowerShell and ANSI &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Ever since PowerShell 7 came along, I&#039;ve been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run Get-PSReadlineOption to see what I&#039;m talking about. Today I have 2 quick...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-15T18:45:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-18T14:33:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun with PowerShell and ANSI\",\"datePublished\":\"2020-05-15T18:45:39+00:00\",\"dateModified\":\"2020-05-18T14:33:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/\"},\"wordCount\":291,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi256-fg.png\",\"keywords\":[\"ANSI\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/\",\"name\":\"Friday Fun with PowerShell and ANSI &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi256-fg.png\",\"datePublished\":\"2020-05-15T18:45:39+00:00\",\"dateModified\":\"2020-05-18T14:33:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi256-fg.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/ansi256-fg.png\",\"width\":1093,\"height\":682},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7479\\\/friday-fun-with-powershell-and-ansi\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun with PowerShell and ANSI\"}]},{\"@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 with PowerShell and ANSI &#8226; The Lonely Administrator","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\/7479\/friday-fun-with-powershell-and-ansi\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun with PowerShell and ANSI &#8226; The Lonely Administrator","og_description":"Ever since PowerShell 7 came along, I've been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run Get-PSReadlineOption to see what I'm talking about. Today I have 2 quick...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-05-15T18:45:39+00:00","article_modified_time":"2020-05-18T14:33:15+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.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":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun with PowerShell and ANSI","datePublished":"2020-05-15T18:45:39+00:00","dateModified":"2020-05-18T14:33:15+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/"},"wordCount":291,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png","keywords":["ANSI","PowerShell","Scripting"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/","name":"Friday Fun with PowerShell and ANSI &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png","datePublished":"2020-05-15T18:45:39+00:00","dateModified":"2020-05-18T14:33:15+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi256-fg.png","width":1093,"height":682},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7479\/friday-fun-with-powershell-and-ansi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Friday Fun with PowerShell and ANSI"}]},{"@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":8853,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8853\/friday-fun-painting-a-pretty-picture-with-powershell\/","url_meta":{"origin":7479,"position":0},"title":"Friday Fun &#8211; Painting a Pretty Picture with PowerShell","author":"Jeffery Hicks","date":"February 11, 2022","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/02\/format-table-colors.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7899,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7899\/color-my-powershell-world\/","url_meta":{"origin":7479,"position":1},"title":"Color My PowerShell World","author":"Jeffery Hicks","date":"November 19, 2020","format":false,"excerpt":"I readily admit that I spend a great deal of my day at a PowerShell prompt. My day is very much run from the command-line, and has been for quite some time. This used to be a drab, gray existence. But I've been finding ways to liven things up. Here's\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\/2020\/11\/ansi-dir.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ansi-dir.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ansi-dir.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ansi-dir.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ansi-dir.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ansi-dir.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7502,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7502\/show-ansi-samples\/","url_meta":{"origin":7479,"position":2},"title":"Show ANSI Samples","author":"Jeffery Hicks","date":"May 29, 2020","format":false,"excerpt":"Earlier this week I did a live session for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions.\u00a0 One of things I talked about was using ANSI escape sequences\u00a0 to add some color.\u00a0 What I realized was that I was constantly referring to my\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\/2020\/05\/ansi-rgb.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ansi-rgb.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7753,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7753\/powershell-color-combos\/","url_meta":{"origin":7479,"position":3},"title":"PowerShell Color Combos","author":"Jeffery Hicks","date":"October 1, 2020","format":false,"excerpt":"A lot of my PowerShell work lately has involved color. I find myself using ANSI escape sequences quite often. I'm also playing with different color schemes in Windows Terminal. And I still on occasion find myself using Write-Host to display colorized messages. What has gotten trickier is that Windows Terminal\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\/2020\/10\/console-colors.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/10\/console-colors.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7956,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7956\/friday-fun-a-powershell-christmas-prompt\/","url_meta":{"origin":7479,"position":4},"title":"Friday Fun &#8211; A PowerShell Christmas Prompt","author":"Jeffery Hicks","date":"December 11, 2020","format":false,"excerpt":"Time for a new Friday Fun article. These articles use \"fun\" ways to teach you how to use PowerShell. The end goal may be silly, but hopefully the techniques and concepts are useful. Today I have an updated prompt function. You can customize your PowerShell prompt by creating a function\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/christmas-countdown.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":8871,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8871\/more-colorful-fun-with-powershell\/","url_meta":{"origin":7479,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7479","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=7479"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7479\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}