NOTE: I strongly recommend this new version.
This has been re-written in C++
which is far more performant than this version and isn't dependent on Bash.
The new version can be found here:
This project is archived in essence, but still open to the public; just not maintained.
As stated above I do not recommend this version over the new C++ version that I do recommend which is linked above or the ☞ new version here ☜.
Fun Bash hybrid function/script to generate a random colorful "Static"/"Matrix" (like?) style animation in a Linux (or any *nix?) command line.
Some time ago (more than a few handfuls of years?) I ran across this static
style loop example and the other style of generic matrix
(with a little 'm
') style script and I have since been facinated with fun, quirky, and geeky things in the command line; no matter how redundant and time wasting. :D
With this function, though, it's not so time wasting as showing this to younger or newer people (my children, for example) can help them understand a few things about the way various things in the code works and if used in the right way it can be a temporary, sort of screensaver while background tasks are running. For example, when I run something and I have to take care of my kids or do work or otherwise, I can keep it running on-screen to look cool.
I have recenty created this more advanced and reusable version of the fun code and added more randomness and color to it with various features and uses.
I did not come up with this initial concept of looping this command; this is, of course, inherit in the printf
command and only the creators can claim it and I'm really not sure who to give credit to; though I would gladly do so.
Having said that, 99.99% of the code and everything here is my creation.
This is dependant on the Bash shell command line as it is created with Bashisms
.
There are two ways to use this:
- A hybrid sourceable/executable function/script (respectively); the function having Bash Completion.
- An executable only AppImage[ 1: DDG Search ].
Any executable file's permission's must must be set to executable:
# Executable for self only
$ chmod u+x /path/to/colorstatic.bash # or .AppImage
# Executable all
$ chmod +x /path/to/colorstatic.bash # or .AppImage
The script can be executed with arguments or sourced into a script or config file as a function with Bash completion.
The AppImage can only be executed with arguments as it is an executable.
You can, of course, change the files name's (colorstatic.bash
and colorstatic.AppImage
) to whatever you want.
$ . /path/to/colorstatic.bash
# Or; assuming [[ -d "$HOME/.bash/functions/" ]] or whatever
$ source $HOME/.bash/functions/colorstatic.bash
$ colorstatic --help
USAGE: colorstatic [OPTION]...
Basic random color animations in the command line.
OPTION:
-h,--help This help screen.
-d,--delay Delay between iterations.
-l,--lines Number of lines; height.
-c,--columns Number of columns; width.
Setting LINES and COLUMNS
implicitly will make it
run faster. If they are not
set this will change size
on terminal size change.
-p,--parts String of random parts.
Defaults to "█ ░ ▒ ▓".
$ /path/to/colorstatic.bash --help
# or if in $PATH:
$ colorstatic.bash --help # or ./colorstatic.bash --help
# Output same as the above function
The AppImage can be assumed to be exactly like and can be executed in the EXACT same way as the executable script.
The examples are better viewed in my YouTube demonstrations since they are animated, but here's a few that shows what it will look like to type them out.
Basic execution with all defaults. This method allows it to change character width and height upon terminal resizing.
$ colorstatic
Set it to a quarter of the current terminal size and slow it down.
$ colorstatic --lines $((LINES/2)) --columns $((COLUMNS/2)) --delay 0.5
# or
$ colorstatic -l $((LINES/2)) -c $((COLUMNS/2)) -d 0.5
# In a script you should use `$(tput lines)` and `$(tput cols)`
# in place of LINES and COLUMNS
By default the displayed characters will be: █ ░ ▒ ▓
, but you can use whatever string or array of characters you like as long as you can display them correctly in your terminal.
You can do this with the -p,--parts
switch.
$ colorstatic --parts '\ /'
# or create array of all decimal ints and lower and upper
# case Latin based characters
$ chars="$(printf '%d ' {0..9};printf '%s ' {a..z} {A..Z})"
$ colorstatic --parts "$chars"
Find video demonstrations with versions of these examples in the list of videos below in the Media
secion: YouTube Videos.
Environment |
---|
Script Test |
---|
AppImage Build |
---|
Description | Status |
---|---|
Last Push Time | |
Project Release Date | |
Total downloads for this project | |
Complete repository size | |
Commits in last month | |
Commits in last year |
Description | Status |
---|---|
Release version | |
Tag version | |
Total downloads for current version |
Name | Code Quality |
---|---|
colorstatic.bash Code |
View this license:
All files can be found in the Continuous Build
page in the Release
section:
Thumbnail | Link - Newest to Oldest |
---|---|
https://youtu.be/GyNQpkrmv50 | |
https://youtu.be/-R8tEdHDCpE | |
https://youtu.be/jSZO-oy7xqI |
If you like this project and care to donate to my PayPal: