R/zzz.R

Defines functions .onAttach use_color_startup

use_color_startup <- function() {
  can_color <- invisible(crayon::has_color())
  if (!can_color) {
    packageStartupMessage("Colors cannot be applied in this environment. Please use another application, such as RStudio or a color-enabled terminal.")
  }
  can_color
}

.onAttach <- function(...) {
  if (!inside_knitr()) {
    use_color_startup()
    ()
  }
}

Try the multicolor package in your browser

Any scripts or data that you put into this service are public.

multicolor documentation built on March 7, 2023, 7:30 p.m.