Crates.io | terminal-fonts |
lib.rs | terminal-fonts |
version | 0.1.0 |
source | src |
created_at | 2020-05-28 16:49:09.066047 |
updated_at | 2020-05-28 16:49:09.066047 |
description | Big fonts for terminal display. Each character is a block formed by many dots. |
homepage | |
repository | https://github.com/sigoden/terminal-fonts |
max_upload_size | |
id | 247093 |
size | 27,334 |
Big fonts for terminal display. Each character is a block formed by many dots.
The font data came from Arcade, font copy rights belongs to the original author.
use terminal_fonts::{to_block_string};
fn main() {
println!("{}", to_block_string("05:30:12 AM"))
}
███ ██████ ██████ ███ ██ █████ ███ ██ ██
█ ██ ██ ██ ██ █ ██ ██ ███ ██ ██ ██ ██ ███ ███
██ ██ ██████ ██ ██ ██ ██ ██ ██ ███ ██ ██ ███████
██ ██ ██ ████ ██ ██ ██ ████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ████ ███████ ██ █ ██
██ █ ██ ██ ██ ██ ██ ██ █ ██ ██ ███ ██ ██ ██ ██
███ █████ ██ █████ ███ ██ ██████ ███████ ██ ██ ██ ██
use terminal_fonts::{map_block, to_block, concat_blocks, to_string};
fn red(v: &str) -> String {
format!("{}{}{}", "\u{001b}[31m", v, "\u{001b}[0m")
}
fn yellow(v: &str) -> String {
format!("{}{}{}", "\u{001b}[33m", v, "\u{001b}[0m")
}
fn blue(v: &str) -> String {
format!("{}{}{}", "\u{001b}[34m", v, "\u{001b}[0m")
}
fn main() {
let hour_block = map_block(&to_block("05"), red);
let minute_block = map_block(&to_block("30"), yellow);
let second_block = map_block(&to_block("12"), blue);
let sep_block = to_block(":");
let result = to_string(&concat_blocks(&vec![
&hour_block,
&sep_block,
&minute_block,
&sep_block,
&second_block,
]));
println!("{}", result)
}