Create a lol
object to pass to lolcat and friends
new()
Create a new lol engine
lol$new(rate = 0.02, angle = pi/4, aspect = 3, palette = NULL)
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.
render()
Render text in colour
lol$render(text, reset = TRUE)
text
Character vector to render
reset
Reset the column on return (i.e, assume text is followed by a newline)
render_line()
Render a single line (i.e., single string) in colour
lol$render_line(text, reset = TRUE)
text
Single string to render
reset
Reset the column on return (i.e, assume text is followed by a newline)
set_as_default()
Set this object as the package default
lol$set_as_default()