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 blue function 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")

## Arguments

... [expressions] Expressions string(s) to format, multiple inputs are concatenated together before formatting. [environment: parent.frame()] Environment to evaluate each expression in. Expressions are evaluated from left to right. If .x is an environment, the expressions are evaluated in that environment and .envir is ignored. [character(1): ‘NA’] Value to replace NA values with. If NULL missing values are propagated, that is an NA result will cause NA output. Otherwise the value is replaced by the value of .na. [listish] An environment, list or data frame used to lookup values.

## Examples

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!
}")
#> glue_col() can show colors
#> and bold and underline too!