# Crossterm: one Rust crate for cursor, color, screen and events on every terminal

> Crossterm is a pure Rust terminal manipulation library for cross-platform text-based interfaces, supporting all UNIX terminals and Windows terminals down to Windows 7, with cursor control, sixteen to RGB color tiers, screen and raw mode management, and mouse, key and resize events through a poll, read or futures Stream interface. The current release is 0.29 and the crate is MIT licensed.

**crossterm-rs/crossterm** — Cross platform terminal library rust. It supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested, see Tested Terminals for more info).

- Repository: https://github.com/crossterm-rs/crossterm
- Stars: 4,236 · Forks: 431
- Language: Rust
- License: MIT
- Published: 2026-08-08 · Updated: 2026-08-18 · Language: en
- Canonical page: https://hysenlabs.com/projects/crossterm-rs-crossterm

## Terminal primitives, pure Rust, Windows 7 upward

Crossterm describes itself as a pure-rust terminal manipulation library that makes it possible to write cross-platform text-based interfaces, and the platform claim is specific, it supports all UNIX and Windows terminals down to Windows 7, with the immediate caveat that not all terminals are tested. The crate is multi-threaded, Send and Sync, keeps few dependencies, gives full control over writing and flushing the output buffer, and offers an Is tty check. The author is T. Post, the license is MIT, and release 0.29 shipped 2025-04-05, following 0.28 in 2024 and 0.27.0 in 2023, with the repository last pushed on 2026-09-14. The getting started snippet in the README adds the dependency as crossterm = "0.27", one major behind the published crate, a small drift worth noticing when copying instructions.

## Cursor and screen as first-class verbs

The cursor surface reads like a checklist of everything a text interface needs. Move the cursor N times up, down, left or right, move to the previous or next line, move to a column, set and get the cursor position, store the position and restore it later, hide and show the cursor, and enable or disable cursor blinking, with the honest note that not all terminals support that last one. The terminal surface is equally concrete. Clear all lines, the current line, from the cursor down, from the cursor up, or until a new line. Scroll up and down. Set and get the terminal size. Set the terminal title. Enable or disable line wrapping. Switch to the alternate screen or the raw screen. And exit the current process, because a library that owns the terminal's unusual states needs a way to end things cleanly.

## Color in three tiers, with platform gates

Styled output comes in three tiers with explicitly gated availability. Foreground and background color work with the sixteen base colors everywhere. The 256 color ANSI palette and full RGB color are supported on Windows 10 and UNIX only, a line drawn straight through the feature list rather than hidden in caveats. Text attributes round it out, bold, italic, underscore, crossed and others, applied through the same command mechanism as color changes. The API offers two interchangeable forms, an execute! macro that takes a queue of commands against stdout, or method chaining on the writer, each command like SetForegroundColor or Print executed in sequence, with ResetColor closing the styled span. Every command variant is enumerated in the supported commands list on docs.rs.

## Events three ways: poll, read, or a Stream

Input is where terminal libraries live or die, and crossterm offers three consumption models over one event type. The poll and read API is the synchronous core, ask whether an event is pending, then read it. The event-stream feature turns events into a futures::Stream producing Result<Event>, for async runtimes, and the examples directory ships both flavors side by side, event-stream-smol.rs and event-stream-tokio.rs, alongside event-poll-read.rs, event-read.rs, event-read-char-line.rs and event-match-modifiers.rs for the modifier cases. The event vocabulary covers input events, mouse events including press, release, position, button and drag, terminal resize events, and advanced modifier support, SHIFT, ALT and CTRL, for both mouse and key events. Bracketed paste, enabled in the default feature set, raises Event::Paste when text is pasted into the terminal.

## Feature flags as a dependency valve

The feature flag table doubles as a diet plan for the dependency tree. The default features are bracketed-paste, derive-more, events and windows. event-stream adds the async stream, serde enables serializing and deserializing events, filedescriptor uses raw file descriptors for all events rather than the mio dependency, derive-more adds is_ helper functions for event types, and osc52 enables crossterm::clipboard, clipboard interaction over OSC52 sequences:

```toml
[dependencies.crossterm]
version = "0.27"
features = ["event-stream"]
```

The thin-layer escape hatch is spelled out, to use crossterm as a very thin layer you can disable the events feature or use filedescriptor, which can disable the mio, signal-hook and signal-hook-mio dependencies entirely. The Cargo.toml also defines use-dev-tty as the raw file descriptor polling option and windows as the gate for winapi and crossterm_winapi on that platform, so a styling-only build pays for no event machinery at all.

## Every dependency has a stated job

A dependency justification table in the README accounts for each crate pulled in. bitflags is always included, backing KeyModifiers which differ based on input. parking_lot is always included, for locking RwLocks with a timeout and const mutexes. libc comes with the events feature on UNIX, for terminal_size, raw modes, set_title and other low level functionality. Mio handles event readiness polling and waking the poller, signal-hook handles the terminal resize signal together with Mio, both optional on UNIX. winapi is Windows only, used for low level system calls which ANSI codes cannot replace. futures-core arrives only with event-stream, serde only with the serde flag, derive_more with its default-on feature, and base64 only with osc52, encoding clipboard data for the OSC52 sequences. The table exists so the few dependencies claim stays verifiable rather than aspirational.

## Tested terminals, from Crostini to Kitty

The tested terminals list names concrete platforms rather than vague claims. On Windows, Console Host on Windows 10 Pro and Windows 8.1 N, and Windows Terminal on Windows 10 x86_64 Enterprise and Windows 11 arm64 Enterprise. On Linux, GNOME Terminal across Ubuntu 23.04, Ubuntu 17.10 and Pop!_OS 20.04, KDE Konsole on Arch and Manjaro, Kitty on Arch and NixOS, Linux Mint, Alacritty on openSUSE, and Crostini on Chrome OS. On Apple hardware, macOS Monterey 12.7.1 on an Intel chip and macOS Sonoma 14.4 on an M1 Max. The crate supports all UNIX terminals and Windows down to 7 regardless, and the README invites anyone who has used it successfully on an unlisted terminal to add it to the list, an admission that coverage claims and verification are separate things, kept honest in public.

## An MSRV the justfile actually checks

The crate manifest declares edition 2024 and rust-version 1.85.0, with a comment that the MSRV covers the library with no default features and with all public features enabled. The justfile turns that from a claim into a check, its msrv recipe reads the version out of Cargo.toml and runs cargo check under it twice, once with no default features and once with all features, exactly matching the stated policy. The full local ci recipe chains format, clippy, docs, doctest, test, msrv, features, package, dependency-policy and workflow-integrity, with tests deliberately single threaded and a features recipe exercising the deliberate Unix compatibility points, including serde, event-stream and no-default-features combinations. A deny.toml sits at the root for dependency policy, and the repository carries a docs directory and a tests directory alongside the examples, including an interactive demo.

## Conclusion

Use crossterm as the terminal layer under a Rust TUI or CLI when the same binary must behave on Linux, macOS and Windows consoles including older Windows, and when you want input handling, styling and screen management from one dependency tree you can trim with feature flags. Look at a full widget toolkit instead if what you actually want is laid out components rather than terminal primitives, crossterm stops at the primitives. Before adopting, check the tested terminals list against your deployment targets, confirm the feature flag set that keeps your dependency tree acceptable, and note the crate's MSRV of Rust 1.85 with edition 2024.

## FAQ

### What is crossterm?

Crossterm is a pure Rust, MIT-licensed terminal manipulation library for writing cross-platform text-based interfaces. It supports all UNIX terminals and Windows terminals down to Windows 7, covering cursor control, styled output, screen and raw mode management, and key, mouse and resize events.

### How do you use crossterm?

Add crossterm = "0.27" to the dependencies in Cargo.toml, as the README's snippet shows, noting the published crate has since reached 0.29. Terminal commands then run through the execute! macro or chained execute calls on stdout, and the examples directory plus the docs.rs documentation cover advanced cases like event streams and modifier matching.

### Which terminals has crossterm been tested on?

The tested list includes Windows Console Host on Windows 10 and 8.1, Windows Terminal on Windows 10 and 11 including arm64, GNOME Terminal on several Ubuntu versions and Pop!_OS, KDE Konsole, Kitty, Linux Mint, Alacritty, Chrome OS Crostini, and macOS Monterey on Intel and Sonoma on M1 Max. Support extends to all UNIX terminals and Windows down to 7, though untested ones are unverified.

## Sources

- [Official README](https://github.com/crossterm-rs/crossterm#readme)
- [Project repository](https://github.com/crossterm-rs/crossterm)
- [Release notes](https://github.com/crossterm-rs/crossterm/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/crossterm-rs-crossterm
