Learn R Programming

GerminaR (version 2.1.5)

textcolor: Colourise text for display in the terminal.

Description

If R is not currently running in a system that supports terminal colours the text will be returned unchanged.

Usage

textcolor(text, fg = "red", bg = NULL)

Arguments

text

character vector

fg

foreground colour, defaults to white

bg

background colour, defaults to transparent

Author

testthat package

Details

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

Examples

Run this code

print(textcolor("Red", "red"))
cat(textcolor("Red", "red"), "\n")
cat(textcolor("White on red", "white", "red"), "\n")

Run the code above in your browser using DataLab