diff --git a/DESCRIPTION b/DESCRIPTION index ed9981b..b3f8dd8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,7 +20,6 @@ Imports: rlang (>= 1.1.0) Suggests: covr, - crayon, knitr, lintr (>= 3.1.0), rmarkdown, diff --git a/R/deprecate.R b/R/deprecate.R index a4eef24..bfe4e91 100644 --- a/R/deprecate.R +++ b/R/deprecate.R @@ -281,7 +281,9 @@ deprecate_warn0 <- function( if (is_interactive()) { footer <- c( footer, - if (!always) silver("This warning is displayed once per session."), + if (!always) { + cli::col_silver("This warning is displayed once per session.") + }, cli::format_inline(cli::col_silver( "Call {.run lifecycle::last_lifecycle_warnings()} to see where this warning was generated." )) diff --git a/R/utils.R b/R/utils.R index 87cedb4..549e8a7 100644 --- a/R/utils.R +++ b/R/utils.R @@ -10,23 +10,6 @@ paste_line <- function(...) { paste(chr(...), collapse = "\n") } -# nocov start -has_crayon <- function() { - is_installed("crayon") && crayon::has_color() -} -red <- function(x) if (has_crayon()) crayon::red(x) else x -blue <- function(x) if (has_crayon()) crayon::blue(x) else x -green <- function(x) if (has_crayon()) crayon::green(x) else x -yellow <- function(x) if (has_crayon()) crayon::yellow(x) else x -magenta <- function(x) if (has_crayon()) crayon::magenta(x) else x -cyan <- function(x) if (has_crayon()) crayon::cyan(x) else x -blurred <- function(x) if (has_crayon()) crayon::blurred(x) else x -silver <- function(x) if (has_crayon()) crayon::silver(x) else x -bold <- function(x) if (has_crayon()) crayon::bold(x) else x -italic <- function(x) if (has_crayon()) crayon::italic(x) else x -underline <- function(x) if (has_crayon()) crayon::underline(x) else x -# nocov end - pkg_url_bug <- function(pkg) { # First check that package is installed, e.g. in case of # runtime-only namespace created by pkgload diff --git a/tests/testthat/test-warning.R b/tests/testthat/test-warning.R index 2a4884a..7bf1396 100644 --- a/tests/testthat/test-warning.R +++ b/tests/testthat/test-warning.R @@ -6,8 +6,7 @@ test_that("deprecation warning is displayed with backtrace", { local_options( rlang_trace_top_env = current_env(), - rlang_trace_format_srcrefs = FALSE, - crayon.enabled = FALSE + rlang_trace_format_srcrefs = FALSE ) f <- function() g()