-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathREADME.Rmd
80 lines (56 loc) · 2.23 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# nationalparkcolors
The goal of nationalparkcolors is to provide an interface to the beautiful colors in National Park posters and images. The posters are a mix of the WPA originals and more modern remakes.
## Installation
You can install the released version of nationalparkcolors from GitHub with:
```{r eval = FALSE}
# install.packages("devtools")
devtools::install_github("katiejolly/nationalparkcolors")
```
```{r echo = FALSE, out.width="200px"}
knitr::include_graphics("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQNS1Au8a9aLV9ZdvMo1F_s22jlx70AHWq3CqlLUNK4O4M2PG0c")
knitr::include_graphics("https://zionpark.org/wp-content/uploads/2018/08/retrobryce.png")
knitr::include_graphics("https://i.pinimg.com/736x/60/d4/c1/60d4c16a3102e33d7c73c9b6bc72c04b.jpg")
```
## Example
There are `r length(nationalparkcolors::park_palettes)` total palettes to choose from.
```{r}
library(nationalparkcolors)
names(park_palettes)
```
You can create a palette in just one command (+ get an image of the palette).
```{r results = 'show'}
pal <- park_palette("MtRainier")
```
If you want a specific number of colors, you can also do that.
```{r}
pal <- park_palette("MtRainier", 4)
```
## Palettes
```{r out.width="300px", echo = FALSE, warning = FALSE, message = FALSE}
print.palette <- function(x, ...) {
n <- length(x)
old <- par(mar = c(0.5, 0.5, 0.5, 0.5))
on.exit(par(old))
image(1:n, 1, as.matrix(1:n), col = x,
ylab = "", xaxt = "n", yaxt = "n", bty = "n")
rect(0, 0.9, n + 1, 1.1, col = rgb(1, 1, 1, 0.8), border = NA)
text((n + 1) / 2, 1, labels = attr(x, "name"), cex = 2, family = "Lato", col = "#32373D")
}
pals <- names(park_palettes)
for (pal in pals){
print.palette(park_palette(pal))
}
```
Along with the nice color palettes, I also hope that people think more about the national park system when using this package. I am not affiliated with the Park Service, but if you'd like to support them you can [donate here](https://www.nps.gov/getinvolved/donate.htm).