Merry XMas

A little fun for christmas: display a flickering christmas tree…
Really usefull!
But can mesmerize more than one child… Best render if the console is resized first (example in the PowerShell Profile Example).

$colors = "Cyan","Green","Yellow","Red","Magenta","White"
Clear-Host
Write-Host

While($true)
{
    $oldpos = $host.ui.RawUI.CursorPosition
    Write-Host "        *" -ForegroundColor ($colors | get-random)
    # Row One
    Write-Host "       *" -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"        -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"        -ForegroundColor ($colors | get-random)
    # Row Two
    Write-Host "      *" -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random)
    # Row Three
    Write-Host "     *"  -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random)
    # Row Four
    Write-Host "    *"   -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random)
    # Row Five
    Write-Host "   *"    -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random)
    # Row Six
    Write-Host "  *"     -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random) -nonewline
    Write-Host "*"       -ForegroundColor DarkGreen              -nonewline
    Write-Host "*"       -ForegroundColor ($colors | get-random)
    # Stump
    Write-Host "       ***       " -ForegroundColor DarkGreen
    Write-Host "       ***       " -ForegroundColor DarkGreen
    $host.ui.RawUI.CursorPosition = $oldpos
    sleep .40
}
Write-Host

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top