@@ -5,8 +5,9 @@ [](LICENSE) [](https://www.linux.org/)
[](https://docs.python.org/3/library/curses.html)
[](https://github.com/yourusername/matrix-ss)
+[](README.md#versions)
-A terminal-based Matrix-style screen saver that simulates the iconic "digital rain" effect from the Matrix movies. This Python script creates falling green characters in your terminal, providing a nostalgic and visually appealing screen saver experience.
+A collection of terminal-based Matrix-style screen savers that simulate the iconic "digital rain" effect from the Matrix movies. Multiple color variants available for different moods and occasions.
## Features
@@ -14,9 +15,10 @@ [](https://en.wikipedia.org/wiki/The_Matrix) [](https://en.wikipedia.org/wiki/Frame_rate)
[](README.md#controls)
[](README.md#technical-details)
+[](README.md#versions)
- 🌟 Authentic Matrix-style digital rain effect
-- 🎨 Green text on terminal background
+- 🎨 Multiple color variants (Green, Red+Green, Rainbow)
- ⚡ Smooth animation (~20 FPS)
- ⌨️ Simple controls (press 'q' to quit)
- 🐧 Linux/Unix compatible
@@ -40,39 +42,100 @@ # Clone or download the repository git clone <repository-url>
cd matrix-ss
-# Make the script executable
-chmod +x matrix.py
+# Make all scripts executable
+chmod +x matrix.py matrix_red.py matrix_rainbow.py
```
### Method 2: Manual Setup
```bash
-# Download matrix.py to your desired location
+# Download all scripts to your desired location
wget <matrix.py-url>
+wget <matrix_red.py-url>
+wget <matrix_rainbow.py-url>
# Make executable
-chmod +x matrix.py
+chmod +x matrix.py matrix_red.py matrix_rainbow.py
```
## Usage
### Basic Usage
```bash
+# Classic Matrix (green only)
python3 matrix.py
+
+# Dramatic Matrix (green + red)
+python3 matrix_red.py
+
+# Rainbow Matrix (all colors)
+python3 matrix_rainbow.py
```
### Alternative Methods
```bash
# If made executable
./matrix.py
+./matrix_red.py
+./matrix_rainbow.py
# Or with python directly
python matrix.py
+python matrix_red.py
+python matrix_rainbow.py
```
### Controls
- **Press 'q'** to quit the screen saver
- **Ctrl+C** to force exit
+## Versions
+
+### 🟢 Classic Matrix (`matrix.py`)
+The original Matrix screen saver with authentic green digital rain effect.
+
+```bash
+python3 matrix.py
+```
+
+**Features:**
+- 🌟 Authentic Matrix movie experience
+- 🟢 Green characters only
+- 🎬 Nostalgic classic look
+
+### 🔴 Dramatic Matrix (`matrix_red.py`)
+Enhanced version with red characters mixed with green for a more dramatic effect.
+
+```bash
+python3 matrix_red.py
+```
+
+**Features:**
+- 🟢 80% green characters
+- 🔴 20% red characters
+- ⚡ Dramatic visual impact
+- 🎭 Perfect for intense moments
+
+### 🌈 Rainbow Matrix (`matrix_rainbow.py`)
+Vibrant rainbow version with all colors of the spectrum for festive occasions.
+
+```bash
+python3 matrix_rainbow.py
+```
+
+**Features:**
+- 🌈 7 rainbow colors (Red, Yellow, Green, Cyan, Blue, Magenta, White)
+- 🎉 Perfect for celebrations and events
+- ✨ Vibrant and eye-catching
+- 🎪 Great for demonstrations
+
+### Version Comparison
+
+| Version | Colors | Effect | Best For |
+|---------|--------|--------|----------|
+| `matrix.py` | Green only | Classic Matrix | Nostalgia, authentic experience |
+| `matrix_red.py` | Green + Red | Dramatic | Intense moments, alerts |
+| `matrix_rainbow.py` | 7 rainbow colors | Festive | Celebrations, demonstrations |
+
## How It Works
The screen saver creates a full-screen terminal animation where:
@@ -129,11 +192,13 @@ - ❌ Windows Command Prompt (not supported)
## Customization
-You can modify the script to change:
+You can modify any of the scripts to change:
- **Speed**: Adjust `time.sleep(0.05)` value
-- **Colors**: Modify `curses.init_pair(1, curses.COLOR_GREEN, -1)`
+- **Colors**: Modify the color pairs in each script
- **Characters**: Change the range in `random.randint(33, 126)`
- **Frame rate**: Modify the `timeout(100)` value
+- **Color distribution**: Adjust the probability ratios in `matrix_red.py`
+- **Rainbow colors**: Add/remove colors from the `rainbow_colors` list in `matrix_rainbow.py`
## License
@@ -0,0 +1,68 @@+#!/usr/bin/env python3
+import curses
+import random
+import time
+
+def main(stdscr):
+ # configura terminal
+ curses.curs_set(0)
+ stdscr.nodelay(True)
+ stdscr.timeout(100) # espera de input e taxa de atualização do loop (ms)
+
+ sh, sw = stdscr.getmaxyx()
+ columns = [0] * sw # posição y para cada coluna
+
+ # inicializa cores do arco-íris
+ curses.start_color()
+ curses.use_default_colors()
+
+ # define pares de cores do arco-íris
+ curses.init_pair(1, curses.COLOR_RED, -1) # vermelho
+ curses.init_pair(2, curses.COLOR_YELLOW, -1) # amarelo
+ curses.init_pair(3, curses.COLOR_GREEN, -1) # verde
+ curses.init_pair(4, curses.COLOR_CYAN, -1) # ciano
+ curses.init_pair(5, curses.COLOR_BLUE, -1) # azul
+ curses.init_pair(6, curses.COLOR_MAGENTA, -1) # magenta
+ curses.init_pair(7, curses.COLOR_WHITE, -1) # branco (brilho)
+
+ # lista de cores do arco-íris
+ rainbow_colors = [
+ curses.color_pair(1), # vermelho
+ curses.color_pair(2), # amarelo
+ curses.color_pair(3), # verde
+ curses.color_pair(4), # ciano
+ curses.color_pair(5), # azul
+ curses.color_pair(6), # magenta
+ curses.color_pair(7), # branco
+ ]
+
+ while True:
+ # detecta tecla 'q' para sair
+ key = stdscr.getch()
+ if key == ord('q'):
+ break
+
+ # não limpa a tela para acumular caracteres
+ for x in range(sw):
+ y = columns[x]
+ char = chr(random.randint(33, 126))
+
+ # escolhe cor aleatória do arco-íris
+ color_pair = random.choice(rainbow_colors)
+
+ try:
+ stdscr.addch(y, x, char, color_pair)
+ except curses.error:
+ pass
+
+ # atualiza posição, reinicia no topo se ultrapassar altura
+ columns[x] = 0 if y >= sh - 1 else y + 1
+
+ stdscr.refresh()
+ time.sleep(0.05) # ajusta taxa de quadros (~20 fps)
+
+if __name__ == '__main__':
+ try:
+ curses.wrapper(main)
+ except KeyboardInterrupt:
+ pass
@@ -0,0 +1,54 @@+#!/usr/bin/env python3
+import curses
+import random
+import time
+
+def main(stdscr):
+ # configura terminal
+ curses.curs_set(0)
+ stdscr.nodelay(True)
+ stdscr.timeout(100) # espera de input e taxa de atualização do loop (ms)
+
+ sh, sw = stdscr.getmaxyx()
+ columns = [0] * sw # posição y para cada coluna
+
+ # inicializa cores
+ curses.start_color()
+ curses.use_default_colors()
+ curses.init_pair(1, curses.COLOR_GREEN, -1) # verde
+ curses.init_pair(2, curses.COLOR_RED, -1) # vermelho
+
+ while True:
+ # detecta tecla 'q' para sair
+ key = stdscr.getch()
+ if key == ord('q'):
+ break
+
+ # não limpa a tela para acumular caracteres
+ for x in range(sw):
+ y = columns[x]
+ char = chr(random.randint(33, 126))
+
+ # escolhe cor: 80% verde, 20% vermelho
+ color_choice = random.random()
+ if color_choice < 0.8:
+ color_pair = curses.color_pair(1) # verde
+ else:
+ color_pair = curses.color_pair(2) # vermelho
+
+ try:
+ stdscr.addch(y, x, char, color_pair)
+ except curses.error:
+ pass
+
+ # atualiza posição, reinicia no topo se ultrapassar altura
+ columns[x] = 0 if y >= sh - 1 else y + 1
+
+ stdscr.refresh()
+ time.sleep(0.05) # ajusta taxa de quadros (~20 fps)
+
+if __name__ == '__main__':
+ try:
+ curses.wrapper(main)
+ except KeyboardInterrupt:
+ pass