Construct strings with color
The crayon package defines a number of functions used to
color terminal output. glue_col()
and glue_data_col()
functions provide
additional syntax to make using these functions in glue strings easier.
Using the following syntax will apply the function crayon::blue()
to the text 'foo bar'.
{blue foo bar}
If you want an expression to be evaluated, simply place that in a normal brace expression (these can be nested).
{blue 1 + 1 = {1 + 1}}
glue_col(..., .envir = parent.frame(), .na = "NA") glue_data_col(.x, ..., .envir = parent.frame(), .na = "NA")
... |
[ |
.envir |
[ |
.na |
[ |
.x |
[ |
if (require(crayon)) { glue_col("{blue foo bar}") glue_col("{blue 1 + 1 = {1 + 1}}") white_on_grey <- bgBlack $ white glue_col("{white_on_grey Roses are {red {colors()[[552]]}} Violets are {blue {colors()[[26]]}} `glue_col()` can show {red c}{yellow o}{green l}{cyan o}{blue r}{magenta s} and {bold bold} and {underline underline} too! }") }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.