Crossterm
A pure-Rust, cross-platform terminal manipulation library
Repository Health
Technical Analysis
Crossterm is a pure-Rust library for cross-platform terminal manipulation, covering cursor movement, text styling and colors, raw/alternate screen modes, and keyboard/mouse/resize event handling. It supports UNIX and Windows terminals down to Windows 7 with a single unified API, abstracting away the very different underlying terminal APIs each platform exposes.
Crossterm is one of the most widely depended-upon crates in the Rust TUI ecosystem, serving as the terminal backend for higher-level TUI frameworks like Ratatui, and is used directly by countless CLI tools that need styled output, interactive prompts, or full-screen terminal UIs without shelling out to platform-specific APIs.
What You Get
- Cursor control: move, hide/show, blink, save/restore position
- Styled output: 16-color, 256-color (ANSI), and RGB foreground/background colors plus text attributes (bold, italic, underline)
- Terminal control: raw mode, alternate screen, scroll, resize, clear, and title-setting
- A unified event system for keyboard, mouse (press/release/drag), and terminal-resize events with modifier key support
- A
commandAPI (queue!/execute!macros) for buffered, flush-controlled output writing - Clipboard integration and bracketed-paste event support
Common Use Cases
- Building full-screen terminal UIs (TUIs) as the low-level backend beneath frameworks like Ratatui
- Adding cross-platform colored/styled output to CLI tools without shelling out to OS-specific APIs
- Building interactive terminal applications that need mouse and keyboard event handling (editors, dashboards, games)
- Writing portable terminal tooling that must behave identically on Windows and UNIX terminals
Under The Hood
Architecture — The crate is organized by terminal concern: src/cursor/, src/style/, src/terminal/, and src/event/ each expose a public module plus platform-specific backend implementations selected at compile time (UNIX ANSI escape-sequence writers vs Windows Console API calls), unified behind a common Command trait (src/command.rs) so callers write one line of code (execute!(stdout, MoveTo(x, y))) regardless of platform. src/tty.rs and src/ansi_support.rs handle detecting whether a stream is a real TTY and whether the terminal actually supports ANSI sequences (relevant on older Windows consoles), falling back accordingly.
Tech Stack — Pure Rust with a deliberately minimal dependency footprint (a stated design goal in the README’s ‘Dependency Justification’ section), using conditional compilation (cfg(windows)/cfg(unix)) rather than separate crates per platform. Feature flags (bracketed-paste, events, windows, derive-more) let consumers opt out of functionality they don’t need to shrink the dependency graph further, similar to other console-rs-family crates.
Code Quality — Roughly 19 source files carry inline #[test]/mod test blocks covering event parsing, cursor/style command construction, and platform-detection logic — reasonable given how much of the remaining logic is platform-specific behavior that’s difficult to unit test outside a real terminal. The crate has a long release history and is depended upon by enough downstream TUI projects (notably Ratatui) that regressions tend to surface quickly through the ecosystem.
API Design — The Command/execute!/queue! macro pair is the core ergonomic device: every terminal action (MoveTo, SetForegroundColor, Clear) implements Command, so execute!(stdout(), MoveTo(0,0), Print("hi")) composes multiple actions into one buffered write without manual escape-sequence construction. This consistency is what makes Crossterm pleasant to build directly on, though full-screen TUI application authors still typically reach for a higher-level framework (Ratatui) built on top rather than using Crossterm’s primitives directly for complex layouts.
Used by 9 apps in this directory
abtop
Developer Tools · Monitoring
Like htop, but for your AI coding agents — monitor Claude Code, Codex CLI, and OpenCode sessions, tokens, context windows, rate limits, and orphan ports all from one terminal screen.
Cameleer
AI Agents
A local-first desktop workspace for managing AI agents in an enterprise-style workflow — agent directory, Kanban task tracking, workspace chat, and a full runtime/audit log of agent actions and tool approvals.
claw-code
AI Agents · AI Code Assistants
A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.
herdr
AI Agents · Developer Tools
A terminal-native agent multiplexer that runs Claude, Codex, Gemini, and other coding agents side by side in real, persistent panes you can detach from and reattach to from anywhere.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
mesh-llm
AI Development · AI Agents
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
OpenViking
Databases · AI Development
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.
PostHog
Analytics · Monitoring · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.