in

[WORKING] PowerShell Rainbow flickers Console Colors rapidly

Pull a prank on your friends with this little script that will make the screen flicker different colors rapidly. PowerShell Rainbow example and demo!

PowerShell Rainbow

In this post, we are going to see how to make PowerShell rainbow.  If you are wondering what is PowerShell rainbow, you are in for a delight.

Everyone is bored with the default blue color of the terminal and would like to see something fancy happen there.  We will show different colors available on PowerShell randomly for fun.

Jump to:

People Also Search For:

PowerShell Console Rainbow:

Pase the below script in PowerShell and watch how the console starts flickering different colors.

while($true){
$Host.ui.RawUI.BackgroundColor = ([Enum]::GetValues([System.ConsoleColor]) | Get-Random)
cls
}

PowerShell grey
PowerShell grey

The above script will be a bit intense for a new user and might be disorienting and so we have provided a easy on eye version below

while($true){
$Host.ui.RawUI.BackgroundColor = ([Enum]::GetValues([System.ConsoleColor]) | Get-Random)
cls

sleep -s 1
}

Powershell maroon
Powershell maroon

PowerShell Console Rainbow with variable speed:

We can make the console flicker and change colors at variable speeds.  In the below script, change the number of seconds for which you want to retain the color.

$second = 1

while($true){
$Host.ui.RawUI.BackgroundColor = ([Enum]::GetValues([System.ConsoleColor]) | Get-Random)
cls

sleep -s $second
}

Powershell pink
Powershell pink

Stop current execution Powershell:

Finally, we need to know how to stop the rainbow as we do not want to be stuck in the un useable console.  Stopping the color flicker is just the same as stopping any PowerShell execution.  We can use the below key combination to stop the color flicker in PowerShell.

ctrl+c

Verdict:

This post was rather different from our usual tutorial post.  Today we had some fun with Powershell console by creating interesting visual effects.  These visual effects are created at random and at a random intervals.  If you wish to control the frequency of the change, we have provided a script in which you can change the seconds of duration.

If you want more such posts, stay tuned to TecKangaroo.

Leave a Reply

Your email address will not be published. Required fields are marked *