Skip to content

Colour palettes inspired by sunsets in the Canadian Prairies.

License

Notifications You must be signed in to change notification settings

mccarthy-m-g/sunsets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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:

Included palettes

Installation

You can install the development version of sunsets from GitHub with:

# install.packages("devtools")
devtools::install_github("mccarthy-m-g/sunsets")

Usage

library(sunsets)
#> Loading required package: palettes

sunsets comes with a set of 2 discrete colour palettes, and 5 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 palettes

To preview the palettes in the console simply print them:

sunset_palettes_discrete

To preview the palettes in the Plots pane use plot():

plot(sunset_palettes_sequential)

To cast palettes to a tibble use as_tibble():

as_tibble(sunset_palettes)

Palettes can be subset using [, [[, and $.

  • To extract one or more palettes use [:

    sunset_palettes_sequential[c("blue", "green")]
  • To extract a single palette as a colour vector use [[ or $:

    sunset_palettes_sequential[["purple"]]
    sunset_palettes_sequential$purple
  • To get names of palettes use names():

    names(sunset_palettes_sequential)
    #> [1] "orange" "blue"   "yellow" "green"  "purple"

Documentation

See also documentation for the palettes package at https://mccarthy-m-g.github.io/palettes/ or in the installed package: help(package = "palettes").

License

CC0

About

Colour palettes inspired by sunsets in the Canadian Prairies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages