Color each element in input with one of the "256 color" ANSI CSI SGR codes. This is intended for testing and demo purposes.

fansi_lines(txt, step = 1)

Arguments

txt

character vector or object that can be coerced to character vector

step

integer(1L) how quickly to step through the color palette

Value

character vector with each element colored

Examples

NEWS <- readLines(file.path(R.home('doc'), 'NEWS'))
writeLines(fansi_lines(NEWS[1:20]))
#> R News
#> 
#> CHANGES IN R 4.4.1:
#> 
#>   C-LEVEL FACILITIES:
#> 
#>     * Functions R_atof and R_strtod declared in header R_ext/Utils.h
#>       are now documented in 'Writing R Extensions' and so formally part
#>       of the API.
#> 
#>     * The non-API entry points Rf_setSVector, Rf_StringFalse,
#>       Rf_StringTrue and Rf_isBlankString have been added to those
#>       reported by R CMD check.
#> 
#>     * The new function Rf_allocLang is now available. This provides an
#>       alternative to the idiom of calling Rf_allocList followed by
#>       SET_TYPEOF.
#> 
#>   UTILITIES:
#> 
writeLines(fansi_lines(NEWS[1:20], step=8))
#> R News
#> 
#> CHANGES IN R 4.4.1:
#> 
#>   C-LEVEL FACILITIES:
#> 
#>     * Functions R_atof and R_strtod declared in header R_ext/Utils.h
#>       are now documented in 'Writing R Extensions' and so formally part
#>       of the API.
#> 
#>     * The non-API entry points Rf_setSVector, Rf_StringFalse,
#>       Rf_StringTrue and Rf_isBlankString have been added to those
#>       reported by R CMD check.
#> 
#>     * The new function Rf_allocLang is now available. This provides an
#>       alternative to the idiom of calling Rf_allocList followed by
#>       SET_TYPEOF.
#> 
#>   UTILITIES:
#>