diff --git a/DESCRIPTION b/DESCRIPTION index c7ecd58..a92abcc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Encoding: UTF-8 Package: ppcli Type: Package Title: Plaintext Board Game Visualizations -Version: 0.3.0-2 +Version: 0.3.0-3 Authors@R: c(person("Trevor L.", "Davis", role=c("aut", "cre"), email="trevor.l.davis@gmail.com", comment = c(ORCID = "0000-0001-6341-4639"))) diff --git a/R/str_piece.R b/R/str_piece.R index b279311..8b219a5 100644 --- a/R/str_piece.R +++ b/R/str_piece.R @@ -7,6 +7,7 @@ #' If `FALSE` won't colorize output at all. #' If `"html"` will colorize output for html. #' Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences. +#' See [cli::ansi_palettes] to customize the colors used. #' @param reorient Determines whether and how we should reorient (the angle) of pieces or symbols:\enumerate{ #' \item{The default "none" (or `FALSE`) means don't reorient any pieces/symbols.} #' \item{"all" (or `TRUE`) means setting the angle to zero for all pieces @@ -129,9 +130,11 @@ str_piece_helper <- function( text <- rev(apply(cm$char, 1, function(x) paste(x, collapse = ""))) text <- paste(text, collapse = "\n") if (color == "html") { + # cli::ansi_html() drops background colors from subsequent spans when + # only the foreground changes; ansi_simplify() does not help + # see https://github.com/r-lib/cli/issues/752 assert_suggested("fansi") text <- fansi::sgr_to_html(text) - # text <- cli::ansi_html(text) } paste0(text, "\n") } diff --git a/man/cat_piece.Rd b/man/cat_piece.Rd index e7d82cd..8ccd33f 100644 --- a/man/cat_piece.Rd +++ b/man/cat_piece.Rd @@ -23,7 +23,8 @@ cat_piece( \item{color}{How should the text be colorized. If \code{FALSE} won't colorize output at all. If \code{"html"} will colorize output for html. -Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences.} +Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences. +See \link[cli:ansi_palettes]{cli::ansi_palettes} to customize the colors used.} \item{reorient}{Determines whether and how we should reorient (the angle) of pieces or symbols:\enumerate{ \item{The default "none" (or \code{FALSE}) means don't reorient any pieces/symbols.} diff --git a/man/str_piece.Rd b/man/str_piece.Rd index 9e99e22..be448b7 100644 --- a/man/str_piece.Rd +++ b/man/str_piece.Rd @@ -22,7 +22,8 @@ str_piece( \item{color}{How should the text be colorized. If \code{FALSE} won't colorize output at all. If \code{"html"} will colorize output for html. -Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences.} +Otherwise will colorize output for the terminal using ANSI CSI SGR control sequences. +See \link[cli:ansi_palettes]{cli::ansi_palettes} to customize the colors used.} \item{reorient}{Determines whether and how we should reorient (the angle) of pieces or symbols:\enumerate{ \item{The default "none" (or \code{FALSE}) means don't reorient any pieces/symbols.}