All Projects → mellite → colorful

mellite / colorful

Licence: MIT license
Make your terminal output colorful.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to colorful

version-compare
↔️ Rust library to easily compare version strings. Mirror from https://gitlab.com/timvisee/version-compare
Stars: ✭ 32 (-25.58%)
Mutual labels:  crates, rust-library
cns
Search through rust crates without leaving the terminal
Stars: ✭ 23 (-46.51%)
Mutual labels:  crates, crates-io
crates-io-cn
Source code of crates-io.cn, also tools sets for sync crates.io
Stars: ✭ 20 (-53.49%)
Mutual labels:  crates, crates-io
Rusticsom
Rust library for Self Organising Maps (SOM).
Stars: ✭ 18 (-58.14%)
Mutual labels:  crates, rust-library
vfin
🦈 GUI framework agnostic virtual DOM library
Stars: ✭ 17 (-60.47%)
Mutual labels:  rust-library
Alexandrie
An alternative crate registry, implemented in Rust.
Stars: ✭ 251 (+483.72%)
Mutual labels:  crates
Staticvec
Implements a fixed-capacity stack-allocated Vec alternative backed by an array, using const generics.
Stars: ✭ 236 (+448.84%)
Mutual labels:  crates
twitter-stream-rs
A Rust library for listening on Twitter Streaming API.
Stars: ✭ 66 (+53.49%)
Mutual labels:  rust-library
Nebuchadnezzar
High Performance Key-Value Store
Stars: ✭ 49 (+13.95%)
Mutual labels:  rust-library
Naersk
Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly.
Stars: ✭ 193 (+348.84%)
Mutual labels:  crates
crc32c
Fast CRC-32-Castagnoli implementation in Rust
Stars: ✭ 26 (-39.53%)
Mutual labels:  rust-library
hidapi-rs
Rust bindings for the hidapi C library
Stars: ✭ 103 (+139.53%)
Mutual labels:  rust-library
contour-rs
Contour polygon creation in Rust (using marching squares algorithm)
Stars: ✭ 33 (-23.26%)
Mutual labels:  rust-library
Deps.rs
Keep your dependencies up-to-date
Stars: ✭ 240 (+458.14%)
Mutual labels:  crates
tentacle
A multiplexed p2p network framework that supports custom protocols
Stars: ✭ 41 (-4.65%)
Mutual labels:  rust-library
Honggfuzz Rs
Fuzz your Rust code with Google-developed Honggfuzz !
Stars: ✭ 222 (+416.28%)
Mutual labels:  crates
wifiscanner
A crate to list WiFi hotspots in your area
Stars: ✭ 47 (+9.3%)
Mutual labels:  crates
arangors
Easy to use rust driver for arangoDB
Stars: ✭ 120 (+179.07%)
Mutual labels:  rust-library
Awesome-Rust-MachineLearning
This repository is a list of machine learning libraries written in Rust. It's a compilation of GitHub repositories, blogs, books, movies, discussions, papers, etc. 🦀
Stars: ✭ 1,110 (+2481.4%)
Mutual labels:  rust-library
stellar-rust-sdk
A lightweight SDK for the stellar horizon api. Written in rust.
Stars: ✭ 34 (-20.93%)
Mutual labels:  crates

Colorful

Build Status Coverage Status Codacy Badge

Usage

Basic Usage

extern crate colorful;

use colorful::Color;
use colorful::Colorful;
//use colorful::HSL;
//use colorful::RGB;

fn main() {
    let s = "Hello world";
    println!("{}", s.color(Color::Blue).bg_color(Color::Yellow).bold());
    //     println!("{}", s.color(HSL::new(1.0, 1.0, 0.5)).bold());
    //     println!("{}", s.color(RGB::new(255, 0, 0)).bold());
    println!("{}", s.blue().bg_yellow());
}

Gradient

extern crate colorful;

use colorful::Color;
use colorful::Colorful;

fn main() {
    println!("{}", "This code is editable and runnable!".gradient(Color::Red));
    println!("{}", "¡Este código es editable y ejecutable!".gradient(Color::Green));
    println!("{}", "Ce code est modifiable et exécutable !".gradient(Color::Yellow));
    println!("{}", "Questo codice è modificabile ed eseguibile!".gradient(Color::Blue));
    println!("{}", "このコードは編集して実行出来ます!".gradient(Color::Magenta));
    println!("{}", "여기에서 코드를 수정하고 실행할 수 있습니다!".gradient(Color::Cyan));
    println!("{}", "Ten kod można edytować oraz uruchomić!".gradient(Color::LightGray));
    println!("{}", "Este código é editável e executável!".gradient(Color::DarkGray));
    println!("{}", "Этот код можно отредактировать и запустить!".gradient(Color::LightRed));
    println!("{}", "Bạn có thể edit và run code trực tiếp!".gradient(Color::LightGreen));
    println!("{}", "这段代码是可以编辑并且能够运行的!".gradient(Color::LightYellow));
    println!("{}", "Dieser Code kann bearbeitet und ausgeführt werden!".gradient(Color::LightBlue));
    println!("{}", "Den här koden kan redigeras och köras!".gradient(Color::LightMagenta));
    println!("{}", "Tento kód můžete upravit a spustit".gradient(Color::LightCyan));
    println!("{}", "این کد قابلیت ویرایش و اجرا دارد!".gradient(Color::White));
    println!("{}", "โค้ดนี้สามารถแก้ไขได้และรันได้".gradient(Color::Grey0));
}

Gradient with style

extern crate colorful;

use colorful::Colorful;

fn main() {
    println!("{}", "言葉にできず 凍えたままで 人前ではやさしく生きていた しわよせで こんなふうに雑に 雨の夜にきみを 抱きしめてた".gradient_with_color(HSL::new(0.0, 1.0, 0.5), HSL::new(0.833, 1.0, 0.5)).underlined());
}

Bar chart

extern crate colorful;

use colorful::Colorful;
use colorful::HSL;

fn main() {
    let s = "█";
    println!("{}\n", "Most Loved, Dreaded, and Wanted Languages".red());
    let values = vec![78.9, 75.1, 68.0, 67.0, 65.6, 65.1, 61.9, 60.4];
    let languages = vec!["Rust", "Kotlin", "Python", "TypeScript", "Go", "Swift", "JavaScript", "C#"];
    let c = languages.iter().max_by_key(|x| x.len()).unwrap();

    for (i, value) in values.iter().enumerate() {
        let h = (*value as f32 * 15.0 % 360.0) / 360.0;
        let length = (value - 30.0) as usize;
        println!("{:<width$} | {} {}%\n", languages.get(i).unwrap(), s.repeat(length).gradient(HSL::new(h, 1.0, 0.5)), value, width = c.len());
    }
}

Output

Animation

Rainbow

extern crate colorful;

use colorful::Colorful;

fn main() {
    let text = format!("{:^50}\n{}\r\n{}", "岳飞 小重山", "昨夜寒蛩不住鸣 惊回千里梦 已三更 起身独自绕阶行 人悄悄 帘外月胧明",
                       "白首为功名 旧山松竹老 阻归程 欲将心事付瑶琴 知音少 弦断有谁听");
    text.rainbow();
}

Output

Neon

extern crate colorful;

use colorful::Colorful;

fn main() {
    let text = format!("{:^28}\n{}", "WARNING", "BIG BROTHER IS WATCHING YOU!!!");
    text.neon(RGB::new(226, 14, 14), RGB::new(158, 158, 158));
    // or you can use text.warn();
}

Output

Terminals compatibility

Terminal Formatting Color
BoldDimUnderlinedBlinkInvertHidden 81688256
aTerm ~
Eterm ~ ~
GNOME Terminal
Guake
Konsole
Nautilus Terminal
rxvt ~
Terminator
Tilda
XFCE4 Terminal
XTerm
xvt
Linux TTY ~
VTE Terminal

~: Supported in a special way by the terminal.

Todo

  • Basic 16 color
  • Extra 240 color
  • HSL support
  • RGB support
  • Gradient mode
  • Rainbow mode
  • Animation mode
  • Document
  • Terminals compatibility

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].