mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
Merge pull request #58 from fdncred/update_gradient
update gradient for better nushell comparisons
This commit is contained in:
commit
6b199476c8
1 changed files with 27 additions and 0 deletions
27
coloring/gradient_40x160.ps1
Normal file
27
coloring/gradient_40x160.ps1
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
function Set-Cursor {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param ([int] $x, [int] $y)
|
||||||
|
$Host.UI.RawUI.CursorPosition = @{x = $x; y = $y }
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-Character {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param ([int]$index)
|
||||||
|
$mystring = ' Trevor Sullivan'
|
||||||
|
return $index -ge ($mystring.Length) ? ' ' : $mystring[$index]
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
# This is the same script as gradient.ps1 but hard coded
|
||||||
|
# to 40x160 for nushell comparisions
|
||||||
|
for ($y = 0; $y -le 39; $y++) {
|
||||||
|
$Color = 25
|
||||||
|
Set-Cursor -x $PSItem -y $y
|
||||||
|
0..159 | ForEach-Object {
|
||||||
|
Write-Host -Object ("`e[48;2;0;0;$Color`m{0}" -f (Get-Character -Index $PSItem)) -NoNewline
|
||||||
|
$Color += 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Add table
Add a link
Reference in a new issue