cfonts 1.0.0

Sexy fonts for the console
Documentation

Cfonts - Sexy fonts for the console

$ cfonts "hi there"

██╗  ██╗ ██╗     ████████╗ ██╗  ██╗ ███████╗ ██████╗  ███████╗
██║  ██║ ██║     ╚══██╔══╝ ██║  ██║ ██╔════╝ ██╔══██╗ ██╔════╝
███████║ ██║        ██║    ███████║ █████╗   ██████╔╝ █████╗
██╔══██║ ██║        ██║    ██╔══██║ ██╔══╝   ██╔══██╗ ██╔══╝
██║  ██║ ██║        ██║    ██║  ██║ ███████╗ ██║  ██║ ███████╗
╚═╝  ╚═╝ ╚═╝        ╚═╝    ╚═╝  ╚═╝ ╚══════╝ ╚═╝  ╚═╝ ╚══════╝

💡 This is a silly little command line tool for sexy fonts in the console. Give your cli some love.


This library supports:

  • different fonts
  • multiple colors per font
  • color gradient
  • text alignment
  • letter spacing and line height options

Usage

Print directly to your console via the println!() macro:

extern crate cfonts;

use cfonts::{ say, Options };

fn main() {
say(Options {
text: String::from("hello"),
..Options::default()
});
}

Or use the output struct however you like:

extern crate cfonts;

use cfonts::{ render, Options, Fonts };

fn main() {
let output = render(Options {
text: String::from("hello"),
font: Fonts::FontTiny,
..Options::default()
});

assert_eq!(
output.text,
format!("{}{}{}",
"\n\n",
" █ █ █▀▀ █   █   █▀█\n",
" █▀█ ██▄ █▄▄ █▄▄ █▄█\n\n"
)
);

assert_eq!(output.vec, vec![
String::from("\n\n █ █ █▀▀ █   █   █▀█"),
String::from(    " █▀█ ██▄ █▄▄ █▄▄ █▄█\n\n"),
]);

assert_eq!(output.lines, 1);

assert_eq!(output.options, Options {
text: String::from("hello"),
font: Fonts::FontTiny,
..Options::default()
});
}