/tui-big-text

A rust crate for rendering large text to the terminal using font8x8 and ratatui.

Primary LanguageRustApache License 2.0Apache-2.0

tui-big-text

Crate badge Docs.rs Badge Deps.rs Badge
License Badge Codecov.io Badge Discord Badge

tui-big-text is a rust crate that renders large pixel text as a Ratatui widget using the glyphs from the font8x8 crate.

Hello World example

Installation

cargo add ratatui tui-big-text

Usage

Create a BigText widget using BigTextBuilder and pass it to Frame::render_widget to render be rendered. The builder allows you to customize the Style of the widget and the PixelSize of the glyphs. The PixelSize can be used to control how many character cells are used to represent a single pixel of the 8x8 font.

Example

use anyhow::Result;
use ratatui::prelude::*;
use tui_big_text::{BigTextBuilder, PixelSize};

fn render(frame: &mut Frame) -> Result<()> {
    let big_text = BigTextBuilder::default()
        .pixel_size(PixelSize::Full)
        .style(Style::new().blue())
        .lines(vec![
            "Hello".red().into(),
            "World".white().into(),
            "~~~~~".into(),
        ])
        .build()?;
    frame.render_widget(big_text, frame.size());
    Ok(())
}

License

Copyright (c) 2023 Josh McKinney

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.