Overcome default colouring schemes (e.g. for packageStartupMessages()) and make sure some text is printed in a contrasting colour depending on the theme (dark or light) in RStudio.

text_col(x)

Arguments

x

Character. Text to print.

Details

Uses crayon for printing white text in dark themes or black text on light themes in RStudio. Borrowed from package tidyverse (https://github.com/tidyverse/tidyverse/blob/72af810106d7249c905d6b0f5b8b42dc33e6ac21/R/utils.R)

Examples

vibass:::text_col("Hello world")
#> [1] "Hello world"
message("Hello world")
#> Hello world
message(vibass:::text_col("Hello world"))
#> Hello world