| multi_colour | R Documentation |
Multi-colour text
multi_colour( txt = "hello world!", colors = "rainbow", type = "message", direction = "vertical", recycle_chars = FALSE, add_leading_newline = FALSE, ... )
txt |
(character) Some text to colour. |
colors |
(character) A vector of colours, defaulting to "rainbow", i.e. c("red", "orange", "yellow", "green", "blue", "purple"). Several out-of-the-box palettes are available; see Must all be |
type |
(character) "message" (the default), "warning", "string", or "rmd". If "rmd" is used, the type of the RMarkdown document should be |
direction |
(character) How should the colours be spread? One of "horizontal" or "vertical". |
recycle_chars |
(logical) Should the vector of colours supplied apply to the entire string or
should it apply to each individual character (if |
add_leading_newline |
Should a newline be added at the beginning of the text? Useful for |
... |
Further args. |
This function evenly (ish) divides up your string into
these colours in the order they appear in colors.
It cannot be used with RGUI (R.app on some systems).
A string if type is "string", or coloured
text if type is "message" or "warning"
## Not run:
multi_colour()
multi_colour("ahoy")
multi_colour(
"taste the rainbow",
c("rainbow", "cyan", "cyan", "rainbow")
)
multi_colour(
"taste the rainbow",
c(
"mediumpurple",
"rainbow",
"cyan3"
)
)
multi_colour(colours = c(
rgb(0.1, 0.2, 0.5),
"yellow",
rgb(0.2, 0.9, 0.1)
))
multi_colour(
things$buffalo,
c("mediumorchid4", "dodgerblue1", "lemonchiffon1")
)
# Built-in colour palette
multi_colour(things$cow, colours = palettes$lacroix)
multi_colour(cowsay:::rms, sample(colours(), 10))
# Mystery Bulgarian animal
multi_colour(things[[sample(length(things), 1)]],
c("white", "darkgreen", "darkred"),
direction = "horizontal"
)
# Mystery Italian animal
multi_colour(things[[sample(length(things), 1)]],
c("darkgreen", "white", "darkred"),
direction = "vertical"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.