Skip to content

About

Asciiquarium-style ASCII aquarium in Rust (port of fishies)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

Repository files navigation

fishies-rs

CI Release Latest release License: GPL v2+

An aquarium/sea animation in ASCII art for the terminal, written in Rust.

This is a port of fishies, a Perl variant of Asciiquarium that draws on the terminal's own background instead of a black one. The Perl version needs Curses and Term::Animation, so it doesn't run on Windows. This port has no curses dependency (it uses crossterm) and runs on Windows, Linux and macOS.

You get the water surface, a castle, swaying seaweed and colorful fish blowing bubbles. One "random object" is always passing by: a ship, a whale with its water spout, a sea monster, a big fish, a shark that eats fish, a fishhook that catches one, a swan, ducks, or dolphins.

Download

Prebuilt binaries are attached to every release:

Latest release: v0.3.1 (release notes, SHA256SUMS.txt)

OS x86_64 arm64 RISC-V
Linux executable · .tar.gz executable · .tar.gz executable · .tar.gz
Windows .exe · .zip .exe · .zip n/a
macOS executable · .tar.gz executable · .tar.gz n/a

Each target comes in two forms:

  • the bare executable, ready to run: fishies-<version>-<target>.exe on Windows, fishies-<version>-<target> elsewhere;
  • an archive with the executable, README and LICENSE: .zip on Windows, .tar.gz elsewhere.

Check downloads against SHA256SUMS.txt. Browsers don't keep the executable bit, so on Linux and macOS run chmod +x fishies-* on a downloaded bare executable before running it. Rust has no Windows or macOS target for RISC-V, so RISC-V builds are Linux only.

On macOS, binaries downloaded with a browser are not notarized. Clear the quarantine flag once:

xattr -d com.apple.quarantine ./fishies

Install with Cargo

cargo install --git https://github.com/darioanguilla/fishies-rs

Or build from source:

cargo build --release
./target/release/fishies

Keys

Key Action
q, Esc, Ctrl+C quit
p pause / resume
r redraw (recreates every object)
a cycle through ASCII, ANSI and graphics mode

Resizing the terminal also rebuilds the scene. The mode is kept across redraws and resizes.

ANSI mode

Press a to switch from the original ASCII art to a truecolor look. The water stays transparent: like in ASCII mode, the terminal's own background shows through.

  • Everything is pixel art drawn with half blocks (▀, ▄), two pixels per cell: fish, castle, seaweed, the rolling water surface, and all the visitors (ship, whale and its spout, sea monster swimming in a sine wave, big fish, shark and its splat, fishhook, swan, ducks, dolphins). Each sprite takes up exactly the cells of its ASCII version, so the animation and collisions don't change.
  • Two things stay as characters, because a whole cell would be too coarse for them: the bubbles (· ◦ ○) and the fishing line (│).

It needs a terminal with 24-bit color and a font with block characters: Windows Terminal, iTerm2, kitty, WezTerm, Alacritty, GNOME Terminal and most modern terminals work.

ASCII ANSI
whale, ASCII mode whale, ANSI mode
shark, ASCII mode shark, ANSI mode
ship over a wallpaper, ASCII mode ship over a wallpaper, ANSI mode

The last row uses a colorful background to show the transparent water. You get the same look in your terminal with a background image or a see-through window:

  • Windows Terminal: Settings → your profile → Appearance → Background image, or Background opacity / Enable acrylic material. In settings.json these are "backgroundImage", "opacity" and "useAcrylic".
  • iTerm2: Settings → Profiles → Window → Background Image or Transparency.
  • kitty: background_image or background_opacity in kitty.conf.
  • WezTerm: window_background_image or window_background_opacity.
  • Alacritty: opacity under [window].

A light or colored terminal theme works too: the water takes the theme's background color.

Every visitor in ANSI mode:

ship whale sea monster
big fish shark fishhook
swan ducks dolphins

Regenerate the screenshots with scripts/screenshots.sh; it needs a Chromium-based browser such as Edge or Chrome.

To always spawn the same random object (handy for debugging), set FISHIES_OBJECT to one of ship, whale, monster, big_fish, shark, fishhook, swan, ducks, dolphins.

Graphics mode

On terminals that can show images, a has a third step: the scene is drawn with real pixels instead of characters, using Sixel or the kitty graphics protocol. The water stays transparent.

  • Four times the resolution of ANSI mode in each direction: 4 x 8 pixels per cell, each about 2.5 x 2.5 screen pixels on a typical 10 x 20 pixel cell. Sprites drawn from shapes (ship, whale, shark, big fish, sea monster) are redrawn at that resolution, with smooth curves and extra details such as rigging, fin rays, throat grooves and pointed teeth. Grid sprites (fish, ducks, swan, dolphins, the hook) are enlarged with Scale2x, which smooths their diagonals instead of making bigger blocks. The castle gets smaller bricks, roof shingles, arched windows and a planked gate; the water a smooth rolling wave and thin ripples.
  • Sprites move pixel by pixel instead of cell by cell.
  • Bubbles are rings and the fishing line is one pixel thin.
Graphics mode Over a wallpaper
shark, graphics mode ship over a wallpaper, graphics mode

Every visitor in graphics mode:

ship whale sea monster
big fish shark fishhook
swan ducks dolphins

Which terminals

At startup fishies asks the terminal, instead of guessing from its name, because support depends on the version and on settings. It sends a kitty graphics query and a DA1 ("device attributes") query, whose answer lists Sixel as attribute 4; it also asks for the size of a cell in pixels. Terminals that answer neither kitty nor Sixel don't get graphics mode. The kitty protocol wins when both are there: it has real transparency and is cheaper for animation.

What to expect (the detection decides, so newer versions may do better):

Terminal OS Graphics
Windows Terminal 1.22 or later Windows Sixel (checked with 1.25)
Windows console host (conhost) Windows none
WezTerm Windows, macOS, Linux kitty, Sixel
mintty (Git Bash, Cygwin) Windows Sixel
VS Code terminal all Sixel, with terminal.integrated.enableImages
iTerm2 macOS Sixel
Terminal.app macOS none
kitty, Ghostty macOS, Linux kitty
Konsole Linux kitty, Sixel
foot, mlterm, contour Linux Sixel
xterm Linux Sixel only when configured as a VT340 (xterm -ti vt340)
GNOME Terminal and other VTE terminals Linux depends on the VTE version
Alacritty all none
tmux, screen off: they need extra setup to pass images through

Run fishies --detect to see what your terminal answered and which mode fishies picks.

When graphics are not available

The a key skips graphics mode and goes from ANSI back to ASCII. The last row briefly says why, for example Graphics mode not available: this terminal supports neither Sixel nor the kitty graphics protocol. Nothing breaks, and there's nothing to configure.

Settings

Variable Effect
FISHIES_GRAPHICS=auto the default: ask the terminal
FISHIES_GRAPHICS=sixel or kitty use that protocol without asking, e.g. inside tmux with passthrough set up
FISHIES_GRAPHICS=off never use graphics mode
FISHIES_CELL=10x20 the cell size in pixels, if the terminal doesn't report it
FISHIES_STATS=1 show the protocol, frame size and encoding time on the last row

The image covers every row but the last one, because a Sixel image that touches the bottom of the screen makes the terminal scroll. The last row is drawn in ANSI mode and shows the messages. A 120 x 40 terminal makes 1200 x 780 pixel frames: about 35 KB and 5 ms each with Sixel, 100 KB with the kitty protocol (measured with cargo test --release graphics_frames -- --ignored --nocapture). That is fine locally, but may stutter over a slow SSH connection.

Development and releases

  • CI (.github/workflows/ci.yml) runs cargo fmt, clippy and the tests on Linux (x86_64, arm64), Windows and macOS for every push and pull request. It also cross-compiles the other release targets. Each run's summary lists the test results for each platform, and the CI badge above shows the state of master.

  • Release (.github/workflows/release.yml) runs after CI succeeds on master and releases automatically. Commit messages follow Conventional Commits, and the next version is computed from the commits since the last tag (.github/scripts/next-version.sh):

    Commits since the last release New version
    a feat: minor: 0.2.0 → 0.3.0
    a fix: or perf: (and no feat:) patch: 0.2.0 → 0.2.1
    type!: or BREAKING CHANGE in a body major (minor while the version is 0.x)
    only docs:, ci:, test:, chore:… no release

    The workflow sets the version in Cargo.toml and Cargo.lock, commits it as release: <version>, creates the v<version> tag, builds all the targets and publishes the GitHub release. It then rewrites the download section of this README (.github/scripts/update-readme.sh) and commits it to master.

To pick the version yourself, set version in Cargo.toml higher than the latest release, run cargo build to update Cargo.lock, and push to master: that version is released as is.

Differences from the Perl original

  • The engine is a small reimplementation of the parts of Term::Animation the script uses (src/engine). Entity callbacks are enums instead of closures.
  • When the fishhook leaves the screen, its hook point is removed too. The original left it behind.
  • rand_color can now pick every color in its list. The original never picked bright magenta.

Credits and license

  • Asciiquarium by Kirk Baucom, most of the ASCII art by Joan Stark.
  • fishies transparency by UndeadLeech, the rwx fishy by qmacro.

Licensed under the GNU General Public License, version 2 or (at your option) any later version, like the original. See LICENSE.

About

Asciiquarium-style ASCII aquarium in Rust (port of fishies)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages