Basic use

For the most basic use, with defaults, just replace cat, message or print with calls to lolcat, lolmessage or lolprint, respectively:

x <- runif(30)
print(x)
#>  [1] 0.87857096 0.71706998 0.35409708 0.70167655 0.87837619 0.50827630
#>  [7] 0.76699699 0.26394402 0.96352254 0.19247125 0.34741863 0.66716402
#> [13] 0.10612157 0.58554327 0.27221065 0.92141677 0.10108200 0.64067503
#> [19] 0.17719900 0.20580976 0.47466444 0.24689850 0.47349931 0.43918601
#> [25] 0.88382896 0.24729677 0.06351769 0.60305413 0.38742332 0.42915423

becomes

rainbowrite::lolprint(x)
#>  [1] 0.87857096 0.71706998 0.35409708 0.70167655 0.87837619 0.50827630
#>  [7] 0.76699699 0.26394402 0.96352254 0.19247125 0.34741863 0.66716402
#> [13] 0.10612157 0.58554327 0.27221065 0.92141677 0.10108200 0.64067503
#> [19] 0.17719900 0.20580976 0.47466444 0.24689850 0.47349931 0.43918601
#> [25] 0.88382896 0.24729677 0.06351769 0.60305413 0.38742332 0.42915423

containing the same great data, but now with much more unicorn flavour.

Advanced use

If this is not enough control, you can interact directly with the rainbowrite::lol object. This has options that can tune the colour cycling. For example, to cycle colours faster than the default, and with a flatter angle (shifting so that rows cycle faster then columns)

lol_faster <- rainbowrite::lol$new(rate = 0.1, angle = pi / 10)

This can be passed into rainbowrite::lolprint and friends:

rainbowrite::lolprint(x, lol = lol_faster)
#>  [1] 0.87857096 0.71706998 0.35409708 0.70167655 0.87837619 0.50827630
#>  [7] 0.76699699 0.26394402 0.96352254 0.19247125 0.34741863 0.66716402
#> [13] 0.10612157 0.58554327 0.27221065 0.92141677 0.10108200 0.64067503
#> [19] 0.17719900 0.20580976 0.47466444 0.24689850 0.47349931 0.43918601
#> [25] 0.88382896 0.24729677 0.06351769 0.60305413 0.38742332 0.42915423

Or can be set as the default

lol_faster$set_as_default()
rainbowrite::lolprint(x)
#>  [1] 0.87857096 0.71706998 0.35409708 0.70167655 0.87837619 0.50827630
#>  [7] 0.76699699 0.26394402 0.96352254 0.19247125 0.34741863 0.66716402
#> [13] 0.10612157 0.58554327 0.27221065 0.92141677 0.10108200 0.64067503
#> [19] 0.17719900 0.20580976 0.47466444 0.24689850 0.47349931 0.43918601
#> [25] 0.88382896 0.24729677 0.06351769 0.60305413 0.38742332 0.42915423

Galaxy brain use

Some packages may not use lolcat, but we may want them to be more colourful.

For example, the cowsay package is great:

cowsay::say("I wish I was more colourful", "cow")
#> 
#>  ----- 
#> I wish I was more colourful 
#>  ------ 
#>     \   ^__^ 
#>      \  (oo)\ ________ 
#>         (__)\         )\ /\ 
#>              ||------w|
#>              ||      ||

but could do with more colours. Use rainbowrite::lolify to create a copy of the target function where some of cat, message or print are replaced by their lol versions

lolcow <- rainbowrite::lolify(cowsay::say)

and use it as

lolcow("These colours mooove me!", "cow", type = "print")
#>  ----- 
#> These colours mooove me! 
#>  ------ 
#>     \   ^__^ 
#>      \  (oo)\ ________ 
#>         (__)\         )\ /\ 
#>              ||------w|
#>              ||      ||