mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-05 19:02:24 +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)
|
param ([Parameter(Mandatory)] [string]$hex)
|
||||||
$nohash = $hex.substring(1)
|
$nohash = $hex.substring(1)
|
||||||
$rgb = $nohash -split '(..)' -ne ''
|
$rgb = $nohash -split '(..)' -ne '' | ForEach-Object { [Convert]::ToInt64($_, 16) }
|
||||||
$r = [Convert]::ToInt64($rgb[0], 16)
|
[char]27 + "$ansi_escape[38;2;{0};{1};{2}m" -f $rgb[0], $rgb[1],$rgb[2]
|
||||||
$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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$Colors = @{
|
$Colors = @{
|
||||||
|
|
Loading…
Reference in a new issue