Create a lol object to pass to lolcat and friends

Methods

Public methods


Method new()

Create a new lol engine

Usage

lol$new(rate = 0.02, angle = pi/4, aspect = 3, palette = NULL)

Arguments

rate

The rate of colour progression in terms of fraction of the colour palette per horizontal line when angle = 0. Increasing values give increasing rate of colour change.

angle

The angle of the colour change. 0 is horizontal lines only, pi / 4 (the default) runs the gradient top-left to bottom-right, pi / 2 changes across columns and so on. Any numeric value is allowed.

aspect

The assumed aspect ratio of rows to columns (used in the treatment of angle).

palette

The colour palette to use. This should be a vector of hex colours that "wrap". We will interpolate along this vector to select a colour for the output. The default is a rainbow set of colours.


Method render()

Render text in colour

Usage

lol$render(text, reset = TRUE)

Arguments

text

Character vector to render

reset

Reset the column on return (i.e, assume text is followed by a newline)


Method render_line()

Render a single line (i.e., single string) in colour

Usage

lol$render_line(text, reset = TRUE)

Arguments

text

Single string to render

reset

Reset the column on return (i.e, assume text is followed by a newline)


Method set_as_default()

Set this object as the package default

Usage

lol$set_as_default()