| x | x | ||||
| } | } | ||||
| list_sassy_themes <- function(style = c("all", "light", "dark")) { | |||||
| if (!requireNamespace("rstudioapi", quietly = TRUE)) { | |||||
| stop("The {rstudioapi} package is required") | |||||
| } | |||||
| if (!rstudioapi::hasFun("getThemes")) { | |||||
| stop("Please upgrade RStudio to version 1.2+") | |||||
| } | |||||
| themes <- rstudioapi::getThemes() | |||||
| themes <- switch( | |||||
| match.arg(style), | |||||
| light = purrr::discard(themes, "isDark"), | |||||
| dark = purrr::keep(themes, "isDark"), | |||||
| themes | |||||
| ) | |||||
| themes <- purrr::map_chr(themes, "name") | |||||
| themes <- themes[grepl("Sassy", themes)] | |||||
| unname(themes) | |||||
| } | |||||
| cp_to_rstudio <- function(file) { | cp_to_rstudio <- function(file) { | ||||
| # cliapp::cli_alert("{arg \"{get_theme_name(file)}\"}") | # cliapp::cli_alert("{arg \"{get_theme_name(file)}\"}") | ||||
| fs::file_copy( | fs::file_copy( |