Skip to content

Instantly share code, notes, and snippets.

@trackd
Last active November 7, 2023 10:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trackd/2b517b3dea776a23016d34dc44930f02 to your computer and use it in GitHub Desktop.
Save trackd/2b517b3dea776a23016d34dc44930f02 to your computer and use it in GitHub Desktop.
-join (1..255 | % { "`e[48;5;$($_)m  {0:00#}  `e[0m" -f $_ + ($_ % 15 -eq 0 ? "`n" : " ") })
-join (1..255 | % { "`e[48;5;$($_)m  {0:00#}  `e[0m" -f $_ + ($_ % ($host.ui.RawUI.WindowSize.Width / 10) -eq 0 ? "`n" : " ") })


#Windows Powershell compatible version
-join (1..255 | % { "$([char]27)[48;5;$($_)m  {0:00#}  $([char]27)[0m" -f $_;if ($_ % ($host.ui.RawUI.WindowSize.Width / 10) -eq 0) { "`n" } else { " " } })
-join (1..255 | % { "`e[48;5;$($_)m    `e[0m`e[48;5;0m`e[38;5;7m{0:00#}`e[0m" -f $_ + ($_ % 15 -eq 0 ? "`n" : " ") })
1..255 | Join-String -f "`e[48;5;{0}m{0,5}    `e[0m" -sep ' '

1..255 | Group-Object -Property { [math]::Floor(($_ - 1) / ($host.ui.RawUI.WindowSize.Width / 10)) } | ForEach-Object {
    $_.Group | Join-String -f "`e[48;5;{0}m  {0:00#}  `e[0m" -Separator " "
}

Ansi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment