sgr_to_html {fansi} | R Documentation |
Only the colors, background-colors, and basic styles (CSI SGR codes 1-9) are translated. Others are dropped silently.
sgr_to_html(x, warn = getOption("fansi.warn"), term.cap = getOption("fansi.term.cap"))
x |
a character vector or object that can be coerced to character. |
warn |
TRUE (default) or FALSE, whether to warn when potentially
problematic Control Sequences are encountered. These could cause the
assumptions |
term.cap |
character a vector of the capabilities of the terminal, can
be any combination "bright" (SGR codes 90-97, 100-107), "256" (SGR codes
starting with "38;5" or "48;5"), and "truecolor" (SGR codes starting with
"38;2" or "48;2"). Changing this parameter changes how |
a character vector with all escape sequences removed and any basic ANSI CSI SGR escape sequences applied via SPAN html objects with inline css styles.
Non-ASCII strings are converted to and returned in UTF-8 encoding.
fansi for details on how Control Sequences are interpreted, particularly if you are getting unexpected results.
sgr_to_html("hello\033[31;42;1mworld\033[m")