style {cursr}R Documentation

Add Color & Attributes to a Character

Description

Add color and other text attributes to a character vector. Attributes can be seen after text is passed to cat, though it may only show up in a terminal. Note that terminal attributes and colors are automatically reset to default after text is printed.

Usage

style(x, fg = NA, bg = NA, attr = NA)

Arguments

x

character vector to be styled

fg

character or numeric value for the foreground color. See fg_on for more details.

bg

character or numeric value for the background color. See bg_on for more details.

attr

character vector describing attributes to turn on. See attr_on for more details.

Value

character vector

See Also

Other style functions: attr_off(), attr_on(), bg_off(), bg_on(), color_off(), color_pair(), fg_off(), fg_on(), make_bg(), make_fg(), make_style(), reset()

Examples

x <- style("Hello World!\n", fg="blue", bg=c(192,192,192), attr=c("ul", "st"))
cat(paste(x, "It is nice to meet you!"))


[Package cursr version 0.1.0 Index]