Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mazznoer/lolcrab

Like lolcat but with noise and more colorful.
https://github.com/mazznoer/lolcrab

cli lolcat rainbow

Last synced: about 1 month ago
JSON representation

Like lolcat but with noise and more colorful.

Awesome Lists containing this project

README

        

# `lolcrab` :crab:

> make your life more colorful, still boring but more colorful

[![Build Status](https://github.com/mazznoer/lolcrab/actions/workflows/ci.yml/badge.svg)](https://github.com/mazznoer/lolcrab/actions)
[![crates.io](https://img.shields.io/crates/v/lolcrab.svg)](https://crates.io/crates/lolcrab)
[![docs.rs](https://docs.rs/lolcrab/badge.svg)](https://docs.rs/lolcrab)

Like [`lolcat`](https://github.com/busyloop/lolcat) but with [noise](https://en.wikipedia.org/wiki/OpenSimplex_noise) and more colorful. This is a fork of [`lcat`](https://github.com/davidkna/lcat-rs).

![lolcrab](docs/images/lolcrab.png)

## Installation

Pre-compiled binaries for Linux, macOS and Windows is avaliable on [release page](https://github.com/mazznoer/lolcrab/releases).

### Cargo

`lolcrab` can be installed using [cargo](https://www.rust-lang.org/tools/install).

```shell
cargo install lolcrab
```

## Usage

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

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

Options:
-g, --gradient 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 Custom gradient in CSS gradient format
--sharp Sharp gradient
-s, --scale Sets noise scale. Try value between 0.01 .. 0.2 [default: 0.034]
-S, --seed Sets seed [default: random]
-i, --invert Colorize the background
-r, --random-colors Use random colors as custom gradient [1 .. 100]
-a, --animate Enable animation mode
-d, --duration Animation duration
--speed Animation speed
-h, --help Print help
-V, --version Print version
```

## Using `lolcrab` as a Library

Add this to your Cargo.toml

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

### Example

```rust
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> {
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(())
}
```