Skip to content

Commit 20f9f52

Browse files
authored
Remove crayon dependency and use cli for styling. (#181)
1 parent ba2ef0b commit 20f9f52

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Imports:
2020
rlang (>= 1.1.0)
2121
Suggests:
2222
covr,
23-
crayon,
2423
knitr,
2524
lintr (>= 3.1.0),
2625
rmarkdown,

R/deprecate.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ deprecate_warn0 <- function(
281281
if (is_interactive()) {
282282
footer <- c(
283283
footer,
284-
if (!always) silver("This warning is displayed once per session."),
284+
if (!always) {
285+
cli::col_silver("This warning is displayed once per session.")
286+
},
285287
cli::format_inline(cli::col_silver(
286288
"Call {.run lifecycle::last_lifecycle_warnings()} to see where this warning was generated."
287289
))

R/utils.R

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@ paste_line <- function(...) {
1010
paste(chr(...), collapse = "\n")
1111
}
1212

13-
# nocov start
14-
has_crayon <- function() {
15-
is_installed("crayon") && crayon::has_color()
16-
}
17-
red <- function(x) if (has_crayon()) crayon::red(x) else x
18-
blue <- function(x) if (has_crayon()) crayon::blue(x) else x
19-
green <- function(x) if (has_crayon()) crayon::green(x) else x
20-
yellow <- function(x) if (has_crayon()) crayon::yellow(x) else x
21-
magenta <- function(x) if (has_crayon()) crayon::magenta(x) else x
22-
cyan <- function(x) if (has_crayon()) crayon::cyan(x) else x
23-
blurred <- function(x) if (has_crayon()) crayon::blurred(x) else x
24-
silver <- function(x) if (has_crayon()) crayon::silver(x) else x
25-
bold <- function(x) if (has_crayon()) crayon::bold(x) else x
26-
italic <- function(x) if (has_crayon()) crayon::italic(x) else x
27-
underline <- function(x) if (has_crayon()) crayon::underline(x) else x
28-
# nocov end
29-
3013
pkg_url_bug <- function(pkg) {
3114
# First check that package is installed, e.g. in case of
3215
# runtime-only namespace created by pkgload

tests/testthat/test-warning.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ test_that("deprecation warning is displayed with backtrace", {
66

77
local_options(
88
rlang_trace_top_env = current_env(),
9-
rlang_trace_format_srcrefs = FALSE,
10-
crayon.enabled = FALSE
9+
rlang_trace_format_srcrefs = FALSE
1110
)
1211

1312
f <- function() g()

0 commit comments

Comments
 (0)