---
title: "Viewing Palettes"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{viewing-palettes}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

Install from CRAN using:
``` {r, eval = FALSE}
install.packages("PrettyCols")
```

Or install the development version using:
``` {r, eval = FALSE}
remotes::install_github("nrennie/PrettyCols")
```

Then load into R:
```{r}
library(PrettyCols)
```

To see the names of all available palettes, run:
```{r}
names(PrettyColsPalettes)
```

To see the colours in a specific palette, use the `prettycols()` function:
```{r, out.width = "100%", fig.align="center"}
prettycols("Tangerines")
```

By default a discrete palette showing all colours is displayed. Setting `type = "continuous"` displays a continuous palette, changing `n` changes the number of colours, and switching `direction = -1` reverses the order of colours. For example:
```{r, out.width = "100%", fig.align="center"}
prettycols("Tangerines", n = 50, type = "continuous", direction = -1)
```

To see all available palettes, run:
```{r, out.width = "100%", fig.align="center"}
view_all_palettes()
```

or, 

```{r, eval = FALSE}
view_all_palettes(type == "all")
```

Palettes are categorised into three types: 

* Sequential (`seq`), 
* Diverging (`div`), 
* Qualitative (`qual`).

Palettes can be viewed by type. For example, to see all sequential colour palettes, run:

```{r, out.width = "100%", fig.align="center"}
view_all_palettes(type = "seq")
```

