소스 검색

Add readme

one
Garrick Aden-Buie 7 년 전
부모
커밋
6c95b33df8
6개의 변경된 파일69개의 추가작업 그리고 8개의 파일을 삭제
  1. +7
    -8
      R/show_colors.R
  2. +47
    -0
      README.Rmd
  3. +15
    -0
      README.md
  4. BIN
      docs/palettes-1.png
  5. BIN
      docs/palettes-2.png
  6. BIN
      docs/palettes-3.png

+ 7
- 8
R/show_colors.R 파일 보기

library(tidyverse)

read_colors <- function(file) { read_colors <- function(file) {
library(dplyr)
text <- readLines(file, warn = FALSE) %>% text <- readLines(file, warn = FALSE) %>%
str_subset("#[0-9a-fA-F]{6}") # must be len-6 hex
stringr::str_subset("#[0-9a-fA-F]{6}") # must be len-6 hex
str_match_all(text, "\\$(.+)\\s*:\\s*(#[0-9a-fA-F]{6});") %>%
discard(~ length(.) < 1) %>%
map_dfr(~ tibble(name = .[, 2], color = .[, 3])) %>%
stringr::str_match_all(text, "\\$(.+)\\s*:\\s*(#[0-9a-fA-F]{6});") %>%
purrr::discard(~ length(.) < 1) %>%
purrr::map_dfr(~ tibble(name = .[, 2], color = .[, 3])) %>%
distinct(name, color) %>% distinct(name, color) %>%
mutate(name = factor(name, unique(name))) mutate(name = factor(name, unique(name)))
} }




show_colors <- function(colors) {
show_colors <- function(colors, ...) {
ggplot(colors) + ggplot(colors) +
aes(1, 1, fill = color) + aes(1, 1, fill = color) +
geom_tile() + geom_tile() +
facet_wrap(~ name + color) +
facet_wrap(~ name + color, ...) +
scale_fill_identity() + scale_fill_identity() +
theme_void() theme_void()
} }

+ 47
- 0
README.Rmd 파일 보기

---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
echo = FALSE,
warning = FALSE, message = FALSE,
fig.path = "docs/"
)
```
# RStudio Themes

<!-- badges: start -->
<!-- badges: end -->

`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"
)

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)
}
```

+ 15
- 0
README.md 파일 보기


<!-- README.md is generated from README.Rmd. Please edit that file -->

# RStudio Themes

<!-- badges: start -->

<!-- badges: end -->

`rstudio-scss` provides SCSS/SASS templates for full RStudio themes for
RStudio version 1.2 (and possibly RStudio 1.2+).

## Palettes

![](docs/palettes-1.png)<!-- -->![](docs/palettes-2.png)<!-- -->![](docs/palettes-3.png)<!-- -->

BIN
docs/palettes-1.png 파일 보기

Before After
Width: 960  |  Height: 384  |  Size: 28KB

BIN
docs/palettes-2.png 파일 보기

Before After
Width: 960  |  Height: 384  |  Size: 25KB

BIN
docs/palettes-3.png 파일 보기

Before After
Width: 960  |  Height: 384  |  Size: 29KB

Loading…
취소
저장