termion
A bindless library for manipulating terminals.
4.0.6
12M downloads/mo
#2798 most downloaded on crates.io
source
What this package is like to depend on
Last release 9 months ago
21 Nov 2025
Release timing varies
gaps range from 5 weeks to 1.7 years
Some releases are documented
notes for 9 of 36 stable releases
1 version withdrawn
withdrawn after publishing
10 years old
37 releases · first in 2016
1 release in the last 12 months
see the full history below
Release timeline
37 releases · Jul 2016 to Nov 2025Releases
latest 37-
4.0.621 Nov 2025 -
4.0.531 Mar 2025 -
4.0.424 Feb 2025Release notes
Open source →- Remove debug printing when parsing CSI sequences
- Support NO_COLOR environment variable
Release notes
Open source →-
Remove debug printing when parsing CSI sequences
-
Support NO_COLOR environment variable
-
4.0.306 Oct 2024 -
4.0.212 Jun 2024Release notes
Open source →Fixes an error check in Ctrl-Arrow code, no difference in behavior. Cleaned up examples.
-
4.0.111 Jun 2024 -
4.0.006 May 2024Release notes
Open source →4.0.0 adds support for horizontal scrolling when working with
MouseTerminal.3.0.0 to 4.0.0 guide
A change is only necessary if you were matching on all variants of the
MouseEventenum without a wildcard. In this case, you need to either handle the two new variants,MouseLeftandMouseRight, or add a wildcard.Release notes
Open source →4.0.0 adds support for horizontal scrolling when working with MouseTerminal .
3.0.0 to 4.0.0 guide
A change is only necessary if you were matching on all variants of the MouseEvent enum without a wildcard. In this case, you need to either handle the two new variants, MouseLeft and MouseRight , or add a wildcard.
-
3.0.005 Jan 2024Release notes
Open source →v3 release improves
rawterminal API and enables support of any TTY target.2.0.0 to 3.0.0 guide
Changes are only required if you were using
IntoRawModeon generic terminalsW: Write. Now, terminal is also required to implementAsFdtrait. So replacing generic bounds withW: Write + AsFdshould be sufficient.Release notes
Open source →v3 release improves raw terminal API and enables support of any TTY target.
2.0.0 to 3.0.0 guide
Changes are only required if you were using IntoRawMode on generic terminals W: Write . Now, terminal is also required to implement AsFd trait . So replacing generic bounds with W: Write + AsFd should be sufficient.
-
2.0.304 Nov 2023Nothing published for this version
-
2.0.204 Nov 2023Nothing published for this version
-
2.0.121 Oct 2022Nothing published for this version
-
2.0.021 Oct 2022Nothing published for this version
-
1.6.021 Oct 2022 withdrawnNothing published for this version
-
1.5.626 Jan 2021Nothing published for this version
-
1.5.520 Jan 2020Nothing published for this version
-
1.5.429 Nov 2019Nothing published for this version
-
1.5.312 Jun 2019Nothing published for this version
-
1.5.221 Apr 2019Nothing published for this version
-
1.5.103 Aug 2017Nothing published for this version
-
1.5.024 Jul 2017Nothing published for this version
-
1.4.010 Jun 2017Nothing published for this version
-
1.3.024 Mar 2017Nothing published for this version
-
1.2.026 Feb 2017Nothing published for this version
-
1.1.418 Dec 2016Nothing published for this version
-
1.1.306 Nov 2016Nothing published for this version
-
1.1.226 Oct 2016Nothing published for this version
-
1.1.124 Sep 2016Nothing published for this version
-
1.1.024 Sep 2016Nothing published for this version
-
1.0.807 Sep 2016Nothing published for this version
-
1.0.707 Sep 2016Nothing published for this version
-
1.0.627 Aug 2016Nothing published for this version
-
1.0.501 Aug 2016Nothing published for this version
-
1.0.429 Jul 2016Nothing published for this version
-
1.0.324 Jul 2016Nothing published for this version
-
1.0.224 Jul 2016Nothing published for this version
-
1.0.124 Jul 2016Nothing published for this version
-
1.0.023 Jul 2016Release notes
Open source →Termion 1.0.0 is out! This release is breaking, which is also the reason for the semver bump.
Highlights
Lot'ta goodies.
- Mouse support: If you enabled mouse mode through the
MouseTerminalstruct, you can get mouse events (thanks to IGI-111). - TrueColor support: You can now use true color, by the
Rgbstruct. - A complete revision of the way escapes are handled: Everything is now done through
Displayinstead of custom traits. isattywrapper:termion::is_ttytakes anyT: AsRawFdand gives you abool.- Crates.io release: Previously, it was distributed solely through git. This turns out to be very convinient, but quite critical whenever making breaking changes (that is, major semver bumps).
0.1.0 to 1.0.0 guide
This sample table gives an idea of how to go bu converting to the new major version of Termion.
0.1.0 1.0.0 use termion::IntoRawModeuse termion::raw::IntoRawModestdout.color(color::Red);write!(stdout, "{}", color::Fg(color::Red));stdout.color_bg(color::Red);write!(stdout, "{}", color::Bg(color::Red));stdout.goto(x, y);write!(stdout, "{}", cursor::Goto(x, y));color::rgb(r, g, b);color::Rgb(r, g, b)(truecolor)x.with_mouse()MouseTerminal::from(x)An example
#![feature(step_by)] extern crate termion; use termion::event::Key; use termion::input::TermRead; use termion::raw::IntoRawMode; use std::io::{Write, stdout, stdin}; fn rainbow<W: Write>(stdout: &mut W, blue: u8) { write!(stdout, "{}{}", termion::cursor::Goto(1, 1), termion::clear::All).unwrap(); for red in (0..255).step_by(8 as u8) { for green in (0..255).step_by(4) { write!(stdout, "{} ", termion::color::Bg(termion::color::Rgb(red, green, blue))).unwrap(); } write!(stdout, "\n\r").unwrap(); } writeln!(stdout, "{}b = {}", termion::style::Reset, blue).unwrap(); } fn main() { let stdin = stdin(); let mut stdout = stdout().into_raw_mode().unwrap(); writeln!(stdout, "{}{}{}Use the arrow keys to change the blue in the rainbow.", termion::clear::All, termion::cursor::Goto(1, 1), termion::cursor::Hide).unwrap(); let mut blue = 172u8; for c in stdin.keys() { match c.unwrap() { Key::Up => { blue = blue.saturating_add(4); rainbow(&mut stdout, blue); }, Key::Down => { blue = blue.saturating_sub(4); rainbow(&mut stdout, blue); }, Key::Char('q') => break, _ => {}, } stdout.flush().unwrap(); } write!(stdout, "{}", termion::cursor::Show).unwrap(); }Release notes
Open source →Termion 1.0.0 is out! This release is breaking, which is also the reason for the semver bump.
Highlights
Lot'ta goodies.
-
Mouse support: If you enabled mouse mode through the MouseTerminal struct, you can get mouse events (thanks to IGI-111).
-
TrueColor support: You can now use true color, by the Rgb struct.
-
A complete revision of the way escapes are handled: Everything is now done through Display instead of custom traits.
-
isatty wrapper: termion::is_tty takes any T: AsRawFd and gives you a bool .
-
Crates.io release: Previously, it was distributed solely through git. This turns out to be very convinient, but quite critical whenever making breaking changes (that is, major semver bumps).
0.1.0 to 1.0.0 guide
This sample table gives an idea of how to go bu converting to the new major version of Termion.
0.1.0 1.0.0
use termion::IntoRawMode use termion::raw::IntoRawMode
stdout.color(color::Red); write!(stdout, "{}", color::Fg(color::Red));
stdout.color_bg(color::Red); write!(stdout, "{}", color::Bg(color::Red));
stdout.goto(x, y); write!(stdout, "{}", cursor::Goto(x, y));
color::rgb(r, g, b); color::Rgb(r, g, b) (truecolor)
x.with_mouse() MouseTerminal::from(x)
An example
#! [ feature ( step_by ) ] extern crate termion ; use termion :: event :: Key ; use termion :: input :: TermRead ; use termion :: raw :: IntoRawMode ; use std :: io :: { Write , stdout , stdin } ; fn rainbow < W : Write > ( stdout : & mut W , blue : u8 ) { write ! ( stdout , "{}{}" , termion :: cursor :: Goto ( 1 , 1 ) , termion :: clear :: All ) . unwrap ( ) ; for red in ( 0 .. 255 ) . step_by ( 8 as u8 ) { for green in ( 0 .. 255 ) . step_by ( 4 ) { write ! ( stdout , "{} " , termion :: color :: Bg ( termion :: color :: Rgb ( red , green , blue ) ) ) . unwrap ( ) ; } write ! ( stdout , " \n \r " ) . unwrap ( ) ; } writeln ! ( stdout , "{}b = {}" , termion :: style :: Reset , blue ) . unwrap ( ) ; } fn main ( ) { let stdin = stdin ( ) ; let mut stdout = stdout ( ) . into_raw_mode ( ) . unwrap ( ) ; writeln ! ( stdout , "{}{}{}Use the arrow keys to change the blue in the rainbow." , termion :: clear :: All , termion :: cursor :: Goto ( 1 , 1 ) , termion :: cursor :: Hide ) . unwrap ( ) ; let mut blue = 172u8 ; for c in stdin . keys ( ) { match c . unwrap ( ) { Key :: Up => { blue = blue . saturating_add ( 4 ) ; rainbow ( & mut stdout , blue ) ; } , Key :: Down => { blue = blue . saturating_sub ( 4 ) ; rainbow ( & mut stdout , blue ) ; } , Key :: Char ( 'q' ) => break , _ => { } , } stdout . flush ( ) . unwrap ( ) ; } write ! ( stdout , "{}" , termion :: cursor :: Show ) . unwrap ( ) ; }
You can’t perform that action at this time.
- Mouse support: If you enabled mouse mode through the