Procházet zdrojové kódy

Add function to list themes

base16
Garrick Aden-Buie před 7 roky
rodič
revize
34c3ac1d48
1 změnil soubory, kde provedl 19 přidání a 0 odebrání
  1. +19
    -0
      R/make_functions.R

+ 19
- 0
R/make_functions.R Zobrazit soubor

@@ -18,6 +18,25 @@ get_theme_name <- function(file) {
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) {
# cliapp::cli_alert("{arg \"{get_theme_name(file)}\"}")
fs::file_copy(

Načítá se…
Zrušit
Uložit