| @@ -27,6 +27,7 @@ knitr::opts_chunk$set( | |||
| library(ggplot2) | |||
| source("R/make_functions.R") | |||
| source("R/show_colors.R") | |||
| fs::dir_create("docs/palettes") | |||
| themes <- list( | |||
| "Solarized" = "_solarized.scss", | |||
| @@ -36,6 +37,8 @@ themes <- list( | |||
| "One Dark" = "_one-dark.scss" | |||
| ) | |||
| pal_files <- c() | |||
| for (theme in names(themes)) { | |||
| theme_file <- fs::path("src", "palettes", themes[[theme]]) | |||
| colors <- read_colors(theme_file) | |||
| @@ -45,16 +48,29 @@ for (theme in names(themes)) { | |||
| theme( | |||
| plot.title = element_text(size = rel(2), hjust = 0.5, margin = margin(t = 20, b = 10)) | |||
| ) | |||
| print(g) | |||
| knitr::opts_current$set(fig.process = function(x) { | |||
| x2 <- sub("([.][a-z]+$)", paste0(themes[[theme]], "\\1"), x) | |||
| if (file.rename(x, x2)) x2 else x1 | |||
| }) | |||
| pal_file <- fs::path("docs", "palettes", themes[[theme]]) | |||
| fs::path_ext(pal_file) <- "png" | |||
| ggsave(pal_file, g, width = 10, height = 4) | |||
| pal_files <- c(pal_files, pal_file) | |||
| } | |||
| knitr::include_graphics(pal_files) | |||
| ``` | |||
| ### Base 16 Palettes | |||
| ```{r base16, fig.width=10, fig.height=4} | |||
| base16_palettes <- fs::dir_ls(here::here("src", "palettes", "base16"), regexp = "_base16") | |||
| pal_files <- c() | |||
| for (base16_pal in base16_palettes) { | |||
| base16_info <- get_base16_theme_info(base16_pal) | |||
| base16_info <- base16_get_theme_info(base16_pal) | |||
| attribution <- stringr::str_remove_all(base16_info$attribution, "(\\s*?(/?\\*/?)\\s*?)") | |||
| attribution <- stringr::str_split(attribution, "by")[[1]] | |||
| attribution <- stringr::str_trim(attribution) | |||
| @@ -71,6 +87,11 @@ for (base16_pal in base16_palettes) { | |||
| plot.title = element_text(size = rel(2), hjust = 0.5, margin = margin(t = 20, b = 10)), | |||
| plot.subtitle = element_text(hjust = 0.5, margin = margin(b = 10)) | |||
| ) | |||
| print(g) | |||
| pal_file <- fs::path("docs", "palettes", fs::path_file(base16_pal)) | |||
| fs::path_ext(pal_file) <- "png" | |||
| ggsave(pal_file, g, width = 10, height = 4) | |||
| pal_files <- c(pal_files, pal_file) | |||
| } | |||
| knitr::include_graphics(pal_files) | |||
| ``` | |||
| @@ -8,12 +8,13 @@ | |||
| <!-- badges: end --> | |||
| `rstudio-scss` provides SCSS/SASS templates for full RStudio themes for | |||
| RStudio version 1.2 (and possibly RStudio 1.2+). | |||
| RStudio version 1.2 (and possibly RStudio | |||
| 1.2+). | |||
| ## Palettes | |||
| <!-- --><!-- --><!-- --><!-- --><!-- --> | |||
| <!-- --><!-- --><!-- --><!-- --><!-- --> | |||
| ### Base 16 Palettes | |||
| <!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> | |||
| <!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> | |||