Description Usage Arguments Value See Also Examples
Prepends and appends the necessary ANSI sequences to produce the requested
style. Valid styles are those in names(ansistyle:::ansi.codes)
.
Nesting is not supported, except for those ANSI sequences that have
different terminators (e.g. font colors vs. background colors). For a better
and more complete implementation see the crayon
package by Gabor
Csardi.
1 | ansi_style(txt, style, use.style = getOption("ansistyle.use.style"))
|
txt |
character vector to style; every element of the vector will have escape sequences added at the beginning and end of the string |
style |
character, either length 1L or same length as |
use.style |
logical(1L) whether to use style or not. Provides a
mechanism for turning off styling for systems that do not support it; if
set to NULL will auto detect with |
character vector, txt
with ansi escape sequences added
valid_ansi_styles
, ansi_style_palette
1 2 3 4 | cat(ansi_style("hello", "red"), "\n")
## some nesting possible if escape sequences allow it
cat(ansi_style(c("baz", ansi_style("foo", "bgGreen"), "bar"), "blue"), "\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.