msg <- function(..., startup = FALSE) {
if (startup) {
if (!isTRUE(getOption("dword.quiet"))) {
packageStartupMessage(text_col(...))
}
} else {
message(text_col(...))
}
}
text_col <- function(x) {
# If RStudio not available, messages already printed in black
if (!rstudioapi::isAvailable()) {
return(x)
}
if (!rstudioapi::hasFun("getThemeInfo")) {
return(x)
}
theme <- rstudioapi::getThemeInfo()
if (isTRUE(theme$dark)) crayon::white(x) else crayon::black(x)
}
msg(
cli::rule(
center = paste0(crayon::bold("Number "), crayon::red(length(sentList)), " --- ",
crayon::bold("Time "), crayon::green(round(elapsed_time[3],2), "s"))
),
startup = TRUE
)
tidyverse.png
dword.png
网友评论