module Lolcat

Overview

The Lolcat module provides methods to colorize text with rainbow colors.

This module serves as the main entry point for using lolcat as a library. It provides simplified methods for adding rainbow colors to text from files or strings.

Defined in:

cli.cr
lolcat.cr
lolcat/action.cr
lolcat/lol.cr
lolcat/options.cr
lolcat/parser.cr
lolcat/version.cr

Constant Summary

VERSION = {{ (`shards version /srv/crystaldoc.info/github-kojix2-lolcat.cr-v0.0.7/src/lolcat`).chomp.stringify }}

The current version of the lolcat program.

This constant is automatically set to the version specified in shard.yml using a macro that runs the shards version command at compile time.

Class Method Summary

Class Method Detail

def self.cat(path : Path, spread : Float64 = 3.0, freq : Float64 = 0.1, offset : Float64 | Nil = nil, invert : Bool = false, force : Bool = false) : Nil #

Print a file with rainbow colors

  • If offset is not provided, it will be random.
  • If force is true, it will force color output even if stdout is not a TTY.

[View source]
def self.cat(input : String, spread : Float64 = 3.0, freq : Float64 = 0.1, offset : Float64 | Nil = nil, invert : Bool = false, force : Bool = false) : Nil #

Print a string with rainbow colors

  • If offset is not provided, it will be random.
  • If force is true, it will force color output even if stdout is not a TTY.

[View source]
def self.lol(input, spread : Float64 = 3.0, freq : Float64 = 0.1, offset : Float64 | Nil = nil, invert : Bool = false, &) : Nil #

Get a rainbow string line by line

  • If offset is not provided, it will be random.

Example:

Lolcat.lol("Rainbow string", invert: true) do |line|
  print line
end

[View source]