Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

col_align

Align an ANSI colored string


Description

Align an ANSI colored string

Usage

col_align(
  text,
  width = getOption("width"),
  align = c("left", "center", "right"),
  type = "width"
)

Arguments

text

The character vector to align.

width

Width of the field to align in.

align

Whether to align "left", "center" or "right".

type

Passed on to col_nchar() and there to nchar()

Value

The aligned character vector.

See Also

Other ANSI string operations: col_nchar(), col_strsplit(), col_substring(), col_substr()

Examples

col_align(red("foobar"), 20, "left")
col_align(red("foobar"), 20, "center")
col_align(red("foobar"), 20, "right")

crayon

Colored Terminal Output

v1.4.1
MIT + file LICENSE
Authors
Gábor Csárdi [aut, cre], Brodie Gaslam [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.