talira

crossterm

Cross-platform terminal manipulation for Rust, on Unix and Windows

open sourceMITfree

crossterm is an open source pure-Rust library for controlling terminals the same way on Unix and Windows: moving and hiding the cursor, styled and coloured output, clearing and scrolling, raw mode and the alternate screen, and reading keyboard, mouse and resize events. Ratatui, Cursive and Broot are built on it.

Problems it solves

  • control the terminal cursor and colours from Rust on Windows and Linux
  • read keyboard and mouse events in a Rust terminal app
  • put the terminal in raw mode for a full-screen Rust TUI

Features

  • works on Unix and Windows terminals
  • cursor movement, position, hiding and blinking
  • 16, 256 and RGB colours and text attributes
  • raw mode, alternate screen, clearing, scrolling and terminal size
  • keyboard, mouse and resize events, with an optional futures Stream

Limitations

  • 256-colour and RGB colour need Windows 10 or Unix1

Alternatives

The same job

These do what crossterm does.

  1. console Terminal access, colours and styling for Rust command-line apps
  2. colored The simplest way to add colours in your terminal from Rust
  3. Ratatui A Rust library for building fast, lightweight, rich terminal user interfaces
  4. indicatif Progress bars and spinners for Rust command-line apps
  5. dialoguer Rust library for interactive command-line prompts

Compare crossterm with the top 3