Note that this is in addition to the builtin theme. To use this theme, you can set it as the cli.theme option:

simple_theme(dark = getOption("cli_theme_dark", "auto"))

Arguments

dark

Whether the theme should be optiomized for a dark background. If "auto", then cli will try to detect this. Detection usually works in recent RStudio versions, and in iTerm on macOS, but not on other platforms.

Details

options(cli.theme = cli::simple_theme())

and then CLI apps started after this will use it as the default theme. You can also use it temporarily, in a div element:

cli_div(theme = cli::simple_theme())

See also

Examples

cli_div(theme = cli::simple_theme()) cli_h1("Heading 1")
#>
#> ── Heading 1 ───────────────────────────────────────────────────────────────────
cli_h2("Heading 2")
#>
#> ── Heading 2 ──
#>
cli_h3("Heading 3")
#> ── Heading 3
cli_alert_danger("Danger alert")
#> Danger alert
cli_alert_warning("Warning alert")
#> ! Warning alert
cli_alert_info("Info alert")
#> Info alert
cli_alert_success("Success alert")
#> Success alert
cli_alert("Alert for starting a process or computation", class = "alert-start")
#> → Alert for starting a process or computation
cli_text("Packages and versions: {.pkg cli} {.version 1.0.0}.")
#> Packages and versions: cli 1.0.0.
cli_text("Time intervals: {.timestamp 3.4s}")
#> Time intervals: 3.4s
cli_text("{.emph Emphasis} and {.strong strong emphasis}")
#> Emphasis and strong emphasis
cli_text("This is a piece of code: {.code sum(x) / length(x)}")
#> This is a piece of code: `sum(x) / length(x)`
cli_text("Function names: {.fn cli::simple_theme}")
#> Function names: `cli::simple_theme()`
cli_text("Files: {.file /usr/bin/env}")
#> Files: /usr/bin/env
cli_text("URLs: {.url https://r-project.org}")
#> URLs: <https://r-project.org>
cli_h2("Longer code chunk")
#>
#> ── Longer code chunk ──
#>
cli_par(class = "code R") cli_verbatim( '# window functions are useful for grouped mutates', 'mtcars %>%', ' group_by(cyl) %>%', ' mutate(rank = min_rank(desc(mpg)))')
#> #> # window functions are useful for grouped mutates #> mtcars %>% #> group_by(cyl) %>% #> mutate(rank = min_rank(desc(mpg))) #>
#>
cli_h2("Even longer code chunk")
#> ── Even longer code chunk ──
#>
cli_par(class = "code R") cli_verbatim(format(ls))
#> #> function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE, #> pattern, sorted = TRUE) #> { #> if (!missing(name)) { #> pos <- tryCatch(name, error = function(e) e) #> if (inherits(pos, "error")) { #> name <- substitute(name) #> if (!is.character(name)) #> name <- deparse(name) #> warning(gettextf("%s converted to character string", #> sQuote(name)), domain = NA) #> pos <- name #> } #> } #> all.names <- .Internal(ls(envir, all.names, sorted)) #> if (!missing(pattern)) { #> if ((ll <- length(grep("[", pattern, fixed = TRUE))) && #> ll != length(grep("]", pattern, fixed = TRUE))) { #> if (pattern == "[") { #> pattern <- "\\[" #> warning("replaced regular expression pattern '[' by '\\\\['") #> } #> else if (length(grep("[^\\\\]\\[<-", pattern))) { #> pattern <- sub("\\[<-", "\\\\\\[<-", pattern) #> warning("replaced '[<-' by '\\\\[<-' in regular expression pattern") #> } #> } #> grep(pattern, all.names, value = TRUE) #> } #> else all.names #> } #>
#>