powered by
If R is not currently running in a system that supports terminal colours the text will be returned unchanged.
colortext(text, fg = "red", bg = NULL)
character vector
foreground colour, defaults to white
background colour, defaults to transparent
testthat package
Allowed colours are: black, blue, brown, cyan, dark gray, green, light blue, light cyan, light gray, light green, light purple, light red, purple, red, white, yellow
print(colortext("Red", "red")) cat(colortext("Red", "red"), "\n") cat(colortext("White on red", "white", "red"), "\n")
Run the code above in your browser using DataLab