mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 05:42:22 +00:00
Cleanup Convert-HexToAnsiiEscape
This commit is contained in:
parent
d88104d0f7
commit
dd285ef4ba
1 changed files with 2 additions and 5 deletions
|
@ -19,11 +19,8 @@ function Convert-HexToAnsiiEscape
|
|||
{
|
||||
param ([Parameter(Mandatory)] [string]$hex)
|
||||
$nohash = $hex.substring(1)
|
||||
$rgb = $nohash -split '(..)' -ne ''
|
||||
$r = [Convert]::ToInt64($rgb[0], 16)
|
||||
$g = [Convert]::ToInt64($rgb[1], 16)
|
||||
$b = [Convert]::ToInt64($rgb[2], 16)
|
||||
[char]27 + "$ansi_escape[38;2;{0};{1};{2}m" -f $r, $g, $b
|
||||
$rgb = $nohash -split '(..)' -ne '' | ForEach-Object { [Convert]::ToInt64($_, 16) }
|
||||
[char]27 + "$ansi_escape[38;2;{0};{1};{2}m" -f $rgb[0], $rgb[1],$rgb[2]
|
||||
}
|
||||
|
||||
$Colors = @{
|
||||
|
|
Loading…
Reference in a new issue