Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/katiejolly/nationalparkcolors
R package for color themes inspired by national parks
https://github.com/katiejolly/nationalparkcolors
Last synced: 3 months ago
JSON representation
R package for color themes inspired by national parks
- Host: GitHub
- URL: https://github.com/katiejolly/nationalparkcolors
- Owner: katiejolly
- Created: 2019-10-22T05:36:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-27T04:13:44.000Z (over 5 years ago)
- Last Synced: 2024-07-28T15:34:26.537Z (7 months ago)
- Language: R
- Size: 72.3 KB
- Stars: 218
- Watchers: 5
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- awesome-r-dataviz - nationalparkcolors - R package for color themes inspired by national parks. (ggplot / Palettes 🎨)
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# nationalparkcolorsThe 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).