Expand description
§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()
});
}
Re-exports§
pub use color::Rgb;
pub use config::Align;
pub use config::BgColors;
pub use config::Colors;
pub use config::Env;
pub use config::Fonts;
pub use config::Options;
pub use render::render;
Modules§
- The contents of this module is all about parsing cli arguments
- The contents of this module is all about transforming letters on the output vector
- The contents of this module is all about cli specific functionality
- The contents of this module is all about colors, color-transformation and color-conversion
- The contents of this module is all about the configuration of this package
- The contents of this module is all about debugging
- The contents of this module is all about getting information about our font
- The contents of this module is all about functions to add gradients to the output of cfonts.
- The contents of this module is all about helper functions
- The contents of this module is all about composing all functions together to render our output
Functions§
- The
say
function will print your cfonts output tostdout
.