1 unstable release

Uses new Rust 2024

new 0.0.10-beta.11 May 17, 2025

#325 in Command-line interface

Download history 103/week @ 2025-05-13

103 downloads per month
Used in 2 crates (via hexga)

MIT/Apache

9KB
120 lines

HexGa Ansi Color

A minimal package for using the Ansi Color :

Provides optional support for Serde (serialization / deserialization) when the "serde" feature is enabled.

use hexga_ansi_color::*;

println!("{}I'm green{}", AnsiColor::GREEN, AnsiColor::RESET);
println!("{}I'm red{}", AnsiColor::new_foreground(AnsiColorKind::Red), AnsiColor::RESET);
println!("{}White on magenta background{}", AnsiColor::new(AnsiColorKind::Magenta, AnsiColorLayer::Background), AnsiColor::RESET);

image

pub enum AnsiColorKind
{
    Black,
    Red,
    Green,
    Yellow,
    Blue,
    Magenta,
    Cyan,
    White,
    Grey,
}

pub enum AnsiColorLayer 
{
    Foreground,
    Background,
}

pub struct AnsiColor
{
    pub color : AnsiColorKind,
    pub layer : AnsiColorLayer,
}

Based on minimal_ansi_color, but integrated to hexga.

Main Hexga crate

Check hexga : https://crates.io/crates/hexga if you are interested in a quick start, it regroup multiple hexga crates.

Dependencies

~150KB