A slowly rotating spiral galaxy for your terminal.
cgalaxy renders a colorful, procedural galaxy using C99 and ncurses. Every
run forms a new system with two to four spiral arms, a luminous core, nebula
dust, differential rotation, and a field of twinkling background stars.
It is lightweight, responsive to terminal resizing, and uses your existing terminal background—including transparent backgrounds.
- Procedural spiral galaxies with a dense galactic core
- Counterclockwise differential rotation
- Five 256-color palettes
- Live controls for speed, density, palette, and arm count
- Unicode and ASCII rendering modes
- Automatic terminal resize handling
- No runtime dependencies beyond ncurses
Install Apple's command-line developer tools if you do not already have them:
xcode-select --installThen build and install cgalaxy:
git clone https://github.com/gibsonmurray/cgalaxy.git
cd cgalaxy
make
make install PREFIX="$HOME/.local"Make sure $HOME/.local/bin is on your PATH. For zsh:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
exec zshsudo apt update
sudo apt install build-essential libncurses-dev
git clone https://github.com/gibsonmurray/cgalaxy.git
cd cgalaxy
make
sudo make installInstall a C99 compiler, make, and the ncurses development package, then run:
make
make install PREFIX="$HOME/.local"Start the galaxy:
cgalaxyChoose a palette or tune the animation at launch:
cgalaxy -p ultraviolet
cgalaxy -d 9 -s 5 -f 30
cgalaxy -a| Option | Description |
|---|---|
-f FPS |
Frames per second, from 5 to 60 (default: 24) |
-d NUM |
Star density, from 1 to 10 (default: 6) |
-s NUM |
Rotation speed, from 0 to 10 (default: 3) |
-p NAME |
Palette: milky-way, andromeda, ultraviolet, ember, or ice |
-a |
Use ASCII glyphs only |
-h |
Show help |
-v |
Show version |
| Key | Action |
|---|---|
q or Esc |
Quit |
Space |
Pause or resume |
r |
Form a new galaxy |
c / C |
Next / previous palette |
a |
Toggle ASCII glyphs |
d / D |
More / fewer stars |
+ / - |
Faster / slower rotation |
[ / ] |
Fewer / more spiral arms |
make # build
make check # run command-line checks
make clean # remove build output
make install # install to PREFIX/bin
make uninstallThe default installation prefix is /usr/local. Set PREFIX to install
elsewhere:
make install PREFIX="$HOME/.local"The renderer generates thousands of particles distributed between a central bulge and logarithmic spiral arms. Stars closer to the core orbit slightly faster than stars near the edge, producing differential rotation. The system is tilted and projected into terminal coordinates, then depth, brightness, twinkle, and palette information determine the glyph and color drawn in each cell.
Use the same prefix that you chose during installation:
make uninstall PREFIX="$HOME/.local"Inspired by realstrawhat/csakura, a lovely falling-sakura animation for the terminal.