Learn R Programming

lares (version 5.1.4)

formatColoured: Print Coloured Messages

Description

Print Coloured Messages

Usage

formatColoured(
  txt,
  colour = c("yellow", "blue", "grey"),
  bold = FALSE,
  cat = TRUE
)

Value

Depends on cat: NULL if TRUE or character string if FALSE.

Arguments

txt

Character. Text to print or transform.

colour

Character. Any of: grey, red, green, yellow, blue, or purple.

bold

Boolean. Set bold text?

cat

Boolean. Print with cat? If not, raw string

Examples

Run this code
opts <- c("GREY", "RED", "GREEN", "YELLOW", "BLUE", "PURPLE")
for (colour in opts) formatColoured(paste("Colour:", colour, "\n"), colour)
formatColoured("my bold coloured text", bold = TRUE, cat = TRUE)

Run the code above in your browser using DataLab