Open XVilka opened 5 years ago
Would have been cool to be able to test if a particular terminal or shell has TRUECOLOR available or not. Maybe a bit redundant, as the new windows console now provide 24-bit Truecolor and most terminals are now offering this. For example, if I ssh into Windows machine from another one, will I be able to get all the coloring?
Made by:
function graybar {
# Truecolor
#Write-Host "`e[38;2;255;100;0mTRUECOLOR`e[0m"
$ts = "TRUECOLOR".ToCharArray()
$tlen = $ts.length
$j = 0 # ts index
$n = 0 # Where on the grayscale to start printing
$ra = 232..255 # color number array
$out = @();
ForEach ($i in $ra) {
if ( ($j -lt $tlen) -AND ( $i -gt $ra[0]+$n-1 ) -AND ($i -lt 255) ) {
$out += "`e[48;5;$($i)m`e[38;2;255;100;0m$($ts[$j])`e[0m`e[m" # letter box
$j++
} else {
$out += "`e[48;5;$($i)m `e[0m" # empty box
}
}
$out -join ""
}
https://github.com/microsoft/terminal one