--- output: github_document --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", echo = FALSE, warning = FALSE, message = FALSE, fig.path = "docs/" ) ``` # RStudio Themes `rstudio-scss` provides SCSS/SASS templates for full RStudio themes for RStudio version 1.2 (and possibly RStudio 1.2+). ## Palettes ```{r palettes, echo=FALSE, results="asis", fig.width=10, fig.height=4} library(ggplot2) source("R/make_functions.R") source("R/show_colors.R") themes <- list( "Solarized" = "_solarized.scss", "Nord" = "_nord.scss", "Oceanic Plus" = "_oceanic-plus.scss", "One Light" = "_one-light.scss", "One Dark" = "_one-dark.scss" ) for (theme in names(themes)) { theme_file <- fs::path("src", "palettes", themes[[theme]]) colors <- read_colors(theme_file) g <- show_colors(colors, ncol = 8) + ggtitle(theme) + coord_equal() + theme( plot.title = element_text(size = rel(2), hjust = 0.5, margin = margin(t = 20, b = 10)) ) print(g) } ``` ### Base 16 Palettes ```{r base16, fig.width=10, fig.height=4} base16_palettes <- fs::dir_ls(here::here("src", "palettes", "base16"), regexp = "_base16") for (base16_pal in base16_palettes) { base16_info <- get_base16_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) attribution_subtitle <- NULL if (length(attribution) == 2) { attribution_subtitle <- attribution[2] } attribution <- paste("base16", attribution[1]) colors <- read_colors(base16_pal) g <- show_colors(colors, ncol = 8) + ggtitle(attribution, if (!is.null(attribution_subtitle)) attribution_subtitle) + coord_equal() + theme( 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) } ```