farve

Crates.iofarve
lib.rsfarve
version0.1.3
sourcesrc
created_at2023-03-07 22:10:18.681738
updated_at2023-03-08 04:11:22.86768
descriptionTiny macros for owo-color'ful logging and printing
homepage
repositoryhttps://github.com/cuppachino/farve
max_upload_size
id803984
size9,521
Jacob Bergholtz (cuppachino)

documentation

README

Farve

🔗docs.rs 🔗crates.io

A bite-sized macro_rules! wrapper around owo-colors for public-facing CLI applications.

use owo_colors::OwoColorize;
use farve::{efarve, farve};

//stdout
farve!(silly, "silly 😋".white().bold(), 2);
farve!(debug, '🐛', 0);
farve!(info, "info".blue(), 1);

// stderr
efarve!(warn, "WARN".bright_yellow(), 2);
efarve!(error, "ERROR".bright_red().underline(), 0);

fn main() {
    silly("Hello, world!");
    debug("We're gonna need a bigger net...");
    info("The weather is nice today.");
    warn("I almost couldn't, but I did it!");
    error("Something went so wrong!");
}

Usage

Add farve to your Cargo.toml:

cargo add farve

farve! and efarve!

use owo_colors::OwoColorize;
use farve::{efarve, farve};

farve!(info);
efarve!(warn, "warning".bright_yellow());

fn main() {
    info("Hello cargo!");
    warn("I almost forgot to show you the brackets 👇");
}

brackets

The final parameter can be used to change the brightness of the brackets.

use farve::{brackets, farve};

fn main() {
    /// ->  [default]
    println!("{}", brackets!("default"));
    
    /// -> [darkest]
    println!("{}", brackets!("darkest", 0));
    
    /// -> [gray]
    println!("{}", brackets!("gray", 1));
    
    /// -> [brightest]
    println!("{}", brackets!("brightest", 2));
}

brackets! can be used through farve! and efarve!

use farve::{farve, efarve};

farve!(spooky,"spooky🎃".red(), 0);
farve!(silly, "silly🤪".white().italic(), 2);
Commit count: 17

cargo fmt