ansi_align: Align an ANSI colored string

Description Usage Arguments Value See Also Examples

View source: R/ansiex.R

Description

Align an ANSI colored string

Usage

1
2
3
4
5
6
ansi_align(
  text,
  width = console_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 ansi_nchar() and there to nchar()

Value

The aligned character vector.

See Also

Other ANSI string operations: ansi_columns(), ansi_nchar(), ansi_strsplit(), ansi_strtrim(), ansi_strwrap(), ansi_substring(), ansi_substr(), ansi_toupper(), ansi_trimws()

Examples

1
2
3
ansi_align(col_red("foobar"), 20, "left")
ansi_align(col_red("foobar"), 20, "center")
ansi_align(col_red("foobar"), 20, "right")

RonMobile/cli documentation built on Dec. 18, 2021, 11 a.m.