R/cli_theme.R

Defines functions get_cli_theme

# See cli::builtin_theme for other options
#' @importFrom cli symbol

get_cli_theme = function() {
  theme = list(
    h1 = list(`font-weight` = "bold", `margin-top` = 1, `margin-bottom` = 0,
              fmt = function(x) cli::rule(x, line_col = "yellow")),
    h2 = list(`font-weight` = "bold",  `margin-top` = 1, `margin-bottom` = 1,
              fmt = function(x)
                paste0(symbol$line, symbol$line, " ", x, " ", symbol$line, symbol$line)),
    h3 = list(`margin-top` = 1,
              fmt = function(x) {
                cli::col_cyan(paste0(symbol$line, symbol$line, " ", x, " "))
              }),
    .alert = list(before = paste0(symbol$arrow_right, " ")),
    `.alert-success` = list(before = paste0(cli::col_green(symbol$tick), " "), color = "green"),
    `.alert-danger` = list(before = paste0(cli::col_red(symbol$cross), " "), color = "red"),
    `.alert-warning` = list(before = paste0(cli::col_yellow(symbol$warning), " ")),
    `.alert-info` = list(before = paste0(cli::col_cyan(symbol$info), " "))
  )
  theme
}
jr-packages/jrNotes documentation built on Dec. 18, 2020, 11:07 p.m.