1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/ansiex.R 3\name{ansi_align} 4\alias{ansi_align} 5\title{Align an ANSI colored string} 6\usage{ 7ansi_align( 8 text, 9 width = console_width(), 10 align = c("left", "center", "right"), 11 type = "width" 12) 13} 14\arguments{ 15\item{text}{The character vector to align.} 16 17\item{width}{Width of the field to align in.} 18 19\item{align}{Whether to align \code{"left"}, \code{"center"} or \code{"right"}.} 20 21\item{type}{Passed on to \code{\link[=ansi_nchar]{ansi_nchar()}} and there to \code{\link[=nchar]{nchar()}}} 22} 23\value{ 24The aligned character vector. 25} 26\description{ 27Align an ANSI colored string 28} 29\details{ 30\if{html}{\out{<div class="sourceCode r">}}\preformatted{str <- c( 31 col_red("This is red"), 32 style_bold("This is bold") 33) 34astr <- ansi_align(str, width = 30) 35boxx(astr) 36}\if{html}{\out{</div>}} 37 38\if{html}{\figure{ansi-align.svg}}\if{html}{\out{<div class="sourceCode r">}}\preformatted{str <- c( 39 col_red("This is red"), 40 style_bold("This is bold") 41) 42astr <- ansi_align(str, align = "center", width = 30) 43boxx(astr) 44}\if{html}{\out{</div>}} 45 46\if{html}{\figure{ansi-align-center.svg}}\if{html}{\out{<div class="sourceCode r">}}\preformatted{str <- c( 47 col_red("This is red"), 48 style_bold("This is bold") 49) 50astr <- ansi_align(str, align = "right", width = 30) 51boxx(astr) 52}\if{html}{\out{</div>}} 53 54\if{html}{\figure{ansi-align-right.svg}} 55} 56\seealso{ 57Other ANSI string operations: 58\code{\link{ansi_columns}()}, 59\code{\link{ansi_nchar}()}, 60\code{\link{ansi_strsplit}()}, 61\code{\link{ansi_strtrim}()}, 62\code{\link{ansi_strwrap}()}, 63\code{\link{ansi_substring}()}, 64\code{\link{ansi_substr}()}, 65\code{\link{ansi_toupper}()}, 66\code{\link{ansi_trimws}()} 67} 68\concept{ANSI string operations} 69