Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mccarthy-m-g/sunsets
Colour palettes inspired by sunsets in the Canadian Prairies.
https://github.com/mccarthy-m-g/sunsets
color-palette colour-palette r r-package r-palettes
Last synced: about 13 hours ago
JSON representation
Colour palettes inspired by sunsets in the Canadian Prairies.
- Host: GitHub
- URL: https://github.com/mccarthy-m-g/sunsets
- Owner: mccarthy-m-g
- License: cc0-1.0
- Created: 2022-12-06T20:17:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-12T22:34:10.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T04:42:23.682Z (about 2 months ago)
- Topics: color-palette, colour-palette, r, r-package, r-palettes
- Language: R
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE, cache = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
cache = FALSE,
asciicast_theme = "pkgdown"
)
asciicast::init_knitr_engine(
startup = quote({
library(sunsets)
set.seed(1) }),
echo = TRUE,
echo_input = FALSE
)
```# sunsets
Colour palettes inspired by sunsets in the Canadian Prairies.
The main purpose of sunsets is to serve as an example showing how to create a colour palette package with the **palettes** package. See the accompanying [Creating a colour palette package](https://mccarthy-m-g.github.io/palettes/articles/creating-packages.html) vignette for a step-by-step guide.
The palettes package provides a comprehensive library for colour vectors and colour palettes using a new family of colour classes (`palettes_colour`, and `palettes_palette`) that always print as hex codes with colour previews. Colour palette packages created with palettes have access to the following capabilities, all without requiring you to write any code: formatting, casting and coercion, extraction and updating of components, plotting, colour mixing arithmetic, and colour interpolation.
See the following vignettes to learn how to use sunsets' palettes with other packages:
- [Using palettes with ggplot2](https://mccarthy-m-g.github.io/palettes/articles/ggplot2.html)
- [Using palettes with gt](https://mccarthy-m-g.github.io/palettes/articles/gt.html)
- [Using palettes with biscale](https://mccarthy-m-g.github.io/palettes/articles/biscale.html)
- [Compatibility with other colour packages](https://mccarthy-m-g.github.io/palettes/articles/compatibility.html)## Included palettes
```{r echo=FALSE}
plot(sunsets::sunset_palettes)
```## Installation
You can install the development version of sunsets from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("mccarthy-m-g/sunsets")
```## Usage
```{r}
library(sunsets)
```sunsets comes with a set of `r length(sunset_palettes_discrete)` discrete colour palettes, and `r length(sunset_palettes_sequential)` sequential colour palettes, which can be accessed from the following R objects:
- `sunset_palettes_discrete` for discrete palettes
- `sunset_palettes_sequential` for sequential palettes
- `sunset_palettes` for all palettesTo preview the palettes in the console simply print them:
```{asciicast sunset-palettes-discrete}
sunset_palettes_discrete
```To preview the palettes in the Plots pane use `plot()`:
```{r plot-sunset-palettes-sequential}
plot(sunset_palettes_sequential)
```To cast palettes to a tibble use `as_tibble()`:
```{asciicast as-tibble}
as_tibble(sunset_palettes)
```Palettes can be subset using `[`, `[[`, and `$`.
- To extract one or more palettes use `[`:
```{asciicast extract-palette}
sunset_palettes_sequential[c("blue", "green")]
```
- To extract a single palette as a colour vector use `[[` or `$`:```{asciicast extract-vector-1}
sunset_palettes_sequential[["purple"]]
```
```{asciicast extract-vector-2}
sunset_palettes_sequential$purple
```
- To get names of palettes use `names()`:```{r}
names(sunset_palettes_sequential)
```## Documentation
See also documentation for the palettes package at [`https://mccarthy-m-g.github.io/palettes/`](https://mccarthy-m-g.github.io/palettes/reference/index.html) or in the installed package: `help(package = "palettes")`.
## License
CC0