Package cli version 3.6.0
Usage
ansi_align(
text,
width = console_width(),
align = c("left", "center", "right"),
type = "width"
)
Arguments
参数【text】:要对齐的字符向量。
参数【width】:要对齐的字段的宽度。
参数【align】:是否对齐“左”、“中”或“右”。
参数【type】:传递给ansi_nchar()和nchar()。
Examples
str <- c(
col_red("This is red"),
style_bold("This is bold")
)
astr <- ansi_align(str, width = 30)
boxx(astr)
┌────────────────────────────────────┐ │ │ │ This is red │ │ This is bold │ │ │ └────────────────────────────────────┘
str <- c(
col_red("This is red"),
style_bold("This is bold")
)
astr <- ansi_align(str, align = "center", width = 30)
boxx(astr)
┌────────────────────────────────────┐ │ │ │ This is red │ │ This is bold │ │ │ └────────────────────────────────────┘
str <- c(
col_red("This is red"),
style_bold("This is bold")
)
astr <- ansi_align(str, align = "right", width = 30)
boxx(astr)
┌────────────────────────────────────┐ │ │ │ This is red │ │ This is bold │ │ │ └────────────────────────────────────┘