Need help with console?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

402 Stars 53 Forks MIT License 218 Commits 10 Opened issues


A rust console and terminal abstraction

Services available


Need anything else?

Contributors list


console is a library for Rust that provides access to various terminal features so you can build nicer looking command line interfaces. It comes with various tools and utilities for working with Terminals and formatting text.

Best paired with other libraries in the family:

Terminal Access

The terminal is abstracted through the

type. It can either directly provide access to the connected terminal or by buffering up commands. A buffered terminal will however not be completely buffered on windows where cursor movements are currently directly passed through.

Example usage:

use std::thread;
use std::time::Duration;

use console::Term;

let term = Term::stdout(); term.write_line("Hello World!")?; thread::sleep(Duration::from_millis(2000)); term.clear_line()?;

Colors and Styles

to control colors. It also provides higher level wrappers for styling text and other things that can be displayed with the
function and utility types.

Example usage:

use console::style;

println!("This is {} neat", style("quite").cyan());

You can also store styles and apply them to text later:

use console::Style;

let cyan = Style::new().cyan(); println!("This is {} neat", cyan.apply_to("quite"));

Working with ANSI Codes

The crate provids the function

to remove ANSI codes from a string as well as
to calculate the width of a string as it would be displayed by the terminal. Both of those together are useful for more complex formatting.

Unicode Width Support

By default this crate depends on the

crate to calculate the width of terminal characters. If you do not need this you can disable the
feature which will cut down on dependencies.

License: MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.