-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
74 lines (52 loc) · 2.33 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# colormind <a href='https://dmi3kno.github.io/colormind'><img src='man/figures/logo.png' align="right" height="200" /></a>
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
The goal of `colormind` is to assist in generating aesthetically pleasing color scales using [colormind.io](http://colormind.io) palette generator.
## Installation
You can install the development version of `colormind` from [Github](https://github.com) with:
``` r
remotes::install_github("dmi3kno/colormind")
```
## Example
Colormind.io is a color scheme generator that uses deep learning. It can learn color styles from photographs, movies, and popular art. Check [colormind.io](http://colormind.io) for currently loaded color models (sample palettes) or retrieve them directly into your R session with `get_colormind_models()`. Color models get updated daily.
```{r example}
library(colormind)
## basic example code
mods <- get_colormind_models()
mods
```
Here's randomly generated palette using "default" color model.
```{r}
colp <- get_colormind_colors()
scales::show_col(colp, borders = NA)
```
You can also "seed" palette with your own colors. In order to do that, you need to pass a color vector (maximum length 5) with some values filled in. If you want something closer to diverging palette, you might want to try placing your suggested colors to opposite ends of a vector.
```{r pressure}
colp <- c("#006494", NA, NA, NA, "#dc493a")
scales::show_col(colp, borders = NA)
```
The missing values in your vector will be complemented by colormind.io using current color model.
```{r}
colr <- get_colormind_colors(colp, "default")
scales::show_col(colr, borders = NA)
```
Colors are randomized every time you hit an API, so you may try it several times, or try another color model.
```{r}
library(purrr)
slow_get_colormind_colors <- slowly(get_colormind_colors, rate = rate_delay(3))
walk(mods, ~slow_get_colormind_colors(colp, model=.x) %>%
scales::show_col(borders = NA))
```