Open meskarune opened 4 years ago
It's a nice proposal. I wanted make the program as faithful to the movie as is possible in the terminal so I definitely thought about this before.
Implementation itself shouldn't be that difficult, the main problem I had was finding the right colors from the ones available in terminals. Maybe just picking the closest available colors (which by itself isn't that trivial) would be fine but maybe adapting them go give a closer "feel" to the real thing might be possible since the movie characters have an outside glow and the dimming gradient can go across a single character, neither of which can be done in the terminal.
Secondary concerns are that by default the background color isn't changed and so can be any color or even transparent which prevents the blending of characters into the background. Some users also change their terminal colors which can the same effect, but I think this should be their concern. A simple solution to this could be to disable dimming when the color is set default and set black as the default chosen without any options.
I'm open if you have any thoughts or suggestions on what the key colors should be or how they should be displayed.
For the 16 colors I think having white, light green, green, grey, black would work, kind of like this:
echo -e "\e[97mW\e[92mLLLLLllll\e[2mGGGGgggggGggg\e[90mDdDD\e[30mbbBB"
With the first character being white the majority of the rest being light green and green then a few on the ends being grey then black. But yes, this only works when the background color matches the black that is configured.
I was thinking more of just having the option of people setting a few color steps themselves, but I guess it's also possible to calculate 256 colors from hex color and also the nearest 16 bit colors. There are already programs written that do this like https://stackoverflow.com/questions/11765623/convert-hex-to-closest-x11-color-number and https://github.com/magarcia/python-x256
There is a program called lolcat that creates a rainbow gradient in terminal text: https://github.com/busyloop/lolcat it's ruby but the math they use is language agnostic in this file: https://github.com/busyloop/lolcat/blob/master/lib/lolcat/lol.rb (it might be kind of fun to have rainbow color matrix rain actually...)
I could definitely try digging through the terminal 256 colors to find a good green gradient if that would be helpful. https://jonasjacek.github.io/colors/ And then maybe write a script to print it out for demonstration.
Thanks for the helpful resources! I'll try to whip something up as soon as I find some time.
Sorry for the delay. I've created a basic color gradient prototype. You can get the diff [here].
This is how it looks:
It seems pretty cool. Let me know what you think!
I've ended up using 256 colors because it made things easier. There are 10 colors and 4 shades (I've excluded the fifth shade since the background is already that color) so when it's complete it will be a big 10x10x4 table of colors. Currently all the colors are green-to-black, so you can play around with it. Let me know if you find any nice combos.
As for lolcat, it would be fun to have that too eventually. How do you imagine it looking? Would the neighboring streaks have the same colors or would each streak begin from a random place in the rainbow? Also would the colors be static as a streak moves so that each coordinate on the screen would always be the same color for the current streak, or would the colors "move" up the streak?
Holy shit that looks incredible :astonished: Really nice job. The rain looks almost 3D!
I think a gradient across sections of code would maybe look a little less "messy" or busy, but there are probably a lot of ways to implement rainbow code :laughing:
I actually have some wallpapers that are rainbow code rain (I think I got them off deviant art years ago) and I made an album of different implementations that others have made. https://imgur.com/a/qcGCxBD maybe it will give you some ideas to play with. I kind of like the rainbow going across the entire thing horizontally or vertically but I don't know what is technically easier to implement. Maybe each line being a rainbow like the vis colors could be interesting too and might be easier than a whole term gradient, idk.
I am so excited to see the matrix reloaded code rain live though!!! As for glowing text... there is a neat terminal emulator that replicates the look of cathode ray screens: https://github.com/Swordfish90/cool-retro-term I bet your program would look amazing on it :grin:
The code has been officially integrated and released as version 1.3!
It would be nice if the code lines had a color gradient going from black to bright greenish/white similar to the matrix revolution movie. Here are screenshots from the actual movie: https://imgur.com/a/cXHwLSN
There is a music visualizer that lets people set color steps: https://github.com/dpayne/cli-visualizer
I have no idea if this feature is desired or difficult to implement so its cool if you decide not to do it.
I always thought the matrix reloaded style looked a lot cooler than the original matrix code rain and no one has made an implementation as far as I know.
Edit by @M4444: Creating subtasks:
[x] Fading characters
[ ] Rainbow code