simply_colored

Crates.iosimply_colored
lib.rssimply_colored
version0.1.0
created_at2025-06-08 19:52:38.165308+00
updated_at2025-06-08 19:52:38.165308+00
descriptionThe simplest crate in existence for terminal colors
homepagehttps://github.com/nik-rev/simply-colored
repositoryhttps://github.com/nik-rev/simply-colored
max_upload_size
id1705218
size504,328
Nik Revenco (nik-rev)

documentation

README

simply_colored

This crate is the simplest yet ergonomic way to add color to your terminal:

use simply_colored::*;

println!("{BLUE}{BOLD}Simply colored!")

Foreground

Color Type To get
Green {GREEN}Simply colored! Green text color in terminal
Yellow {YELLOW}Simply colored! Yellow text color in terminal
Red {RED}Simply colored! Red text color in terminal
Magenta {MAGENTA}Simply colored! Magenta text color in terminal
Blue {BLUE}Simply colored! Blue text color in terminal
Cyan {CYAN}Simply colored! Cyan text color in terminal
White {WHITE}Simply colored! White text color in terminal
Black {BLACK}Simply colored! Black text color in terminal
Dim green {DIM_GREEN}Simply colored! Dim green text color in terminal
Dim yellow {DIM_YELLOW}Simply colored! Dim yellow text color in terminal
Dim red {DIM_RED}Simply colored! Dim red text color in terminal
Dim magenta {DIM_MAGENTA}Simply colored! Dim magenta text color in terminal
Dim blue {DIM_BLUE}Simply colored! Dim blue text color in terminal
Dim cyan {DIM_CYAN}Simply colored! Dim cyan text color in terminal
Dim white {DIM_WHITE}Simply colored! Dim white text color in terminal
Dim black {DIM_BLACK}Simply colored! Dim black text color in terminal

Background

Color Type To get
Green {BG_GREEN}Simply colored! Green text color in terminal
Yellow {BG_YELLOW}Simply colored! Yellow text color in terminal
Red {BG_RED}Simply colored! Red text color in terminal
Magenta {BG_MAGENTA}Simply colored! Magenta text color in terminal
Blue {BG_BLUE}Simply colored! Blue text color in terminal
Cyan {BG_CYAN}Simply colored! Cyan text color in terminal
White {BG_WHITE}Simply colored! White text color in terminal
Black {BG_BLACK}Simply colored! Black text color in terminal
Dim green {BG_DIM_GREEN}Simply colored! Dim green text color in terminal
Dim yellow {BG_DIM_YELLOW}Simply colored! Dim yellow text color in terminal
Dim red {BG_DIM_RED}Simply colored! Dim red text color in terminal
Dim magenta {BG_DIM_MAGENTA}Simply colored! Dim magenta text color in terminal
Dim blue {BG_DIM_BLUE}Simply colored! Dim blue text color in terminal
Dim cyan {BG_DIM_CYAN}Simply colored! Dim cyan text color in terminal
Dim white {BG_DIM_WHITE}Simply colored! Dim white text color in terminal
Dim black {BG_DIM_BLACK}Simply colored! Dim black text color in terminal

Effects

Effect Type
Italic {ITALIC}Simply colored!
Bold {BOLD}Simply colored!
Underline {UNDERLINE}Simply colored!
Blink {BLINK}Simply colored!
Reverse {REVERSE}Simply colored!
Strikethrough {STRIKETHROUGH}Simply colored!
Dim {DIM}Simply colored!
Hide {HIDE}Simply colored!
Reset all styles {RESET}Simply colored!

All effects can be prefixed with NO_ to disable e.g. NO_BOLD.

Extra

If you want links in the terminal, all you need is:

fn hyperlink(link: impl core::fmt::Display, text: impl core::fmt::Display) -> String {
    format!("\x1b]8;;{link}\x1b\\{text}\x1b]8;;\x1b\\")
}

Example usage:

println!(
    "Check out simply_colored on {}!",
    hyperlink(
        "https://github.com/nik-rev/simply-colored",
        "GitHub"
    )
);
Commit count: 22

cargo fmt