10 releases

0.4.0 Aug 22, 2024
0.3.1 May 4, 2023
0.3.0 Oct 15, 2022
0.2.0 May 12, 2022
0.0.1 Jul 20, 2021

#768 in Command line utilities

Download history 138/week @ 2024-08-19 14/week @ 2024-08-26 17/week @ 2024-09-16 45/week @ 2024-09-23 17/week @ 2024-09-30 16/week @ 2024-10-07 20/week @ 2024-10-14 6/week @ 2024-10-21

60 downloads per month

MIT/Apache

28KB
607 lines

lolcrab 🦀

make your life more colorful, still boring but more colorful

Build Status crates.io docs.rs

Like lolcat but with noise and more colorful. This is a fork of lcat.

lolcrab

Installation

Pre-compiled binaries for Linux, macOS and Windows is avaliable on release page.

Cargo

lolcrab can be installed using cargo.

cargo install lolcrab

Usage

Usage: lolcrab [OPTIONS] [File]...

Arguments:
  [File]...  Files to read [default: -]

Options:
  -g, --gradient <NAME>        Sets color gradient [default: rainbow] [possible values: cividis, cool, cubehelix,
                               fruits, inferno, magma, plasma, rainbow, rd-yl-gn, sinebow, spectral, turbo,
                               viridis, warm]
      --presets                Show all preset gradients
  -c, --custom <CSS Gradient>  Custom gradient in CSS gradient format
      --sharp <NUM>            Sharp gradient
  -s, --scale <FLOAT>          Sets noise scale. Try value between 0.01 .. 0.2 [default: 0.034]
  -S, --seed <NUM>             Sets seed [default: random]
  -i, --invert                 Colorize the background
  -r, --random-colors <NUM>    Use random colors as custom gradient [1 .. 100]
  -a, --animate                Enable animation mode
  -d, --duration <NUM>         Animation duration
      --speed <SPEED>          Animation speed
  -h, --help                   Print help
  -V, --version                Print version

Using lolcrab as a Library

Add this to your Cargo.toml

lolcrab = { version = "0.4", default-features = "false" }

Example

use lolcrab::Lolcrab;
use std::io;

const TEXT: &str = "\
•••••••••••••••••••••••••••••••••••••••••••
••442463299144744830108724702438783348716••
••665891426009540978622724448305819269356••
••078289454141226451790882961903610719673••
••56505384476•••••••••••••••••39761609699••
••47928752907•• { lolcrab } ••33810561851••
••51609982385•••••••••••••••••43459368213••
••980457234663167653959566555465520046709••
••677103598707232478714861999441705454744••
••012721882924436718718457599087686681354••
•••••••••••••••••••••••••••••••••••••••••••
";

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let stdout = io::stdout();
    let mut stdout = stdout.lock();

    // Initialize Lolcrab using default gradient and default noise
    let mut lol = Lolcrab::new(None, None);

    lol.colorize_str(TEXT, &mut stdout)?;

    lol.set_invert(true);
    lol.randomize_position();
    lol.colorize_str(TEXT, &mut stdout)?;

    lol.set_invert(false);
    lol.reset_position();
    lol.colorize_str(TEXT, &mut stdout)?;

    Ok(())
}

Dependencies

~3–12MB
~134K SLoC