blo_cli

Crates.ioblo_cli
lib.rsblo_cli
version0.2.1
created_at2026-01-04 21:15:06.222825+00
updated_at2026-01-04 21:24:28.573073+00
descriptionA simple Rust library for styling terminal text with ANSI escape codes
homepagehttps://github.com/Blonar257/blo_cli
repositoryhttps://github.com/Blonar257/blo_cli
max_upload_size
id2022498
size15,752
Stefan Schrage (Blonar257)

documentation

README

blo_cli

A simple Rust library for styling terminal text with ANSI escape codes.

Features

  • Colors: Supports foreground colors (Red, Green, Blue, Yellow, Pink, Cyan, White, Black) and background colors.
  • Text Styles: Bold, Italic, Underline.
  • Borders: Create borders around text with Angular or Rounded style, optionally with colors.

Installation

Add the library to your project:

cargo add blo_cli

Or clone the repository and build it locally:

git clone https://github.com/Blonar257/blo_cli.git
cd blo_cli
cargo build

Usage

Example

use blo_cli::colors::Color;
use blo_cli::colors::{fg_colorize, bg_colorize};
use blo_cli::styles::{TextStyle, style, BorderStyle, border};

fn main() {
    // Color text in blue
    println!("{}", fg_colorize("Hello World!", Color::Blue));

    // Make text bold
    println!("{}", style("Hello World!", TextStyle::Bold));

    // Underline text
    println!("{}", style("Hello World!", TextStyle::Underline));

    // Text with angular border
    println!("{}", border("Hello World!", BorderStyle::Angular, None));

    // Text with rounded border in red
    println!("{}", border("Hello World!", BorderStyle::Rounded, Some(Color::Red)));
}

Border Functions

The border() function creates a border around text:

use blo_cli::styles::{BorderStyle, border};
use blo_cli::colors::Color;

// Simple angular border (without color)
println!("{}", border("Info", BorderStyle::Angular, None));

// Rounded border in red
println!("{}", border("Warning", BorderStyle::Rounded, Some(Color::Red)));

// Multi-line text with border
println!("{}", border("Line 1\nLine 2", BorderStyle::Angular, Some(Color::Green)));

BorderStyle Options:

  • BorderStyle::Angular: Angular corners (┌─┐│└┘)
  • BorderStyle::Rounded: Rounded corners (╭─╮│╰╯)

Colors: All colors (Red, Green, Blue, Yellow, Pink, Cyan, White, Black) are supported.

Complete Demo

See examples/demo.rs for more examples, including background colors and borders.

Tests

Run the tests:

cargo test

License

This project is licensed under the MIT License.

Commit count: 0

cargo fmt