#terminal #draw #give

bin+lib termdraw

A crate, which allows you to draw in the terminal

7 releases

0.1.6 Jan 20, 2024
0.1.5 Jan 20, 2024

#4 in #give

Download history 7/week @ 2024-01-14 6/week @ 2024-02-25 16/week @ 2024-03-10 2/week @ 2024-03-17 102/week @ 2024-03-31

120 downloads per month

MIT license

13KB
226 lines

termdraw

A crate, which allows you to draw in the terminal.

Quick Start

You can find this crate on crates.io.

You can use cargo:

cargo add termdraw

Or include termdraw = "*" in the Cargo.toml file.

Exapmle

use crossterm::{
    cursor::SetCursorStyle,
    queue,
    style::Color::*,
    terminal::{Clear, ClearType},
};
use std::{
    io::{stdout, Result, Write},
    thread::sleep,
    time::Duration,
};

use termdraw::shape::{self, *};

fn main() -> Result<()> {
    let mut out = stdout();

    loop {
        queue!(out, Clear(ClearType::All))?;
        queue!(out, SetCursorStyle::SteadyBlock)?;

        draw_background!(out, Black);
        draw_custom_shape!(out, [0, 0, 10, 0, 5, 5], White, true);

        out.flush()?;

        sleep(Duration::from_millis(500));
    }
}

lib.rs:

A crate that makes it possible to draw in the terminal.

Dependencies

~0.8–7MB
~20K SLoC