8000 GitHub - nik-rev/simply-colored: The simplest crate in existence for terminal colors
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nik-rev/simply-colored

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"
    )
);

About

The simplest crate in existence for terminal colors

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0