Package 'crayons'

Title: Color Palettes from Crayon Boxes
Description: Provides color palettes based on crayon colors since the early 1900s. Colors are based on various crayon colors, sets, and promotional palettes, most of which can be found at <https://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors>. All palettes are discrete palettes and are not necessarily color-blind friendly. Provides scales for 'ggplot2' for discrete coloring.
Authors: Christopher T. Kenny [aut, cre]
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.0.3
Built: 2024-08-24 04:14:42 UTC
Source: https://github.com/christopherkenny/crayons

Help Index


Crayons Color Palettes

Description

Crayon colors, based on common Crayola colors. Palettes build from Wikipedia

Usage

crayons

Format

list of palette::palette vectors

Details

Included palettes:

  • billionth, celebrates the 100 billionth crayon

  • color_n_smell, scented colors

  • colors_of_the_world, additional human colors

  • construction_paper, colors for construction paper

  • fluorescent, neon colors

  • gel_fx, gel colors

  • gem_tones, gemstones

  • heads_n_tails, double sided colors

  • magic_scent, scented colors

  • metallic_fx, metal colors

  • mini_twistables, colors, but twistable

  • modern, historical colors since 1990

  • munsell, historical colors 1926-1944

  • multicultural, skin colors

  • no_48, historical crayons 48-pack in 1949

  • no_64, historical crayons 64-pack in 1958

  • original, historical crayons original in 1903

  • pearl, updated perlescent colors

  • pearl_brite, pearlescent colors

  • silly_scents, scented in reality but not in R

  • silver_swirls, colors with a tinge of silver

  • standard, a large set of standard colors

  • standard16, colors for a 16 pack of crayons

  • standard24, colors for a 24 pack of crayons

  • standard32, colors for a 32 pack of crayons

  • standard64, colors for a 64 pack of crayons

  • star_brite, colors from 1997

Examples

plot(crayons$billionth)
plot(crayons$color_n_smell)
plot(crayons$colors_of_the_world)
plot(crayons$construction_paper)
plot(crayons$fluorescent)
plot(crayons$gel_fx)
plot(crayons$gem_tones)
plot(crayons$heads_n_tails)
plot(crayons$magic_scent)
plot(crayons$metallic_fx)
plot(crayons$mini_twistables)
plot(crayons$modern)
plot(crayons$munsell)
plot(crayons$multicultural)
plot(crayons$no_48)
plot(crayons$no_64)
plot(crayons$original)
plot(crayons$pearl)
plot(crayons$pearl_brite)
plot(crayons$silly_scents)
plot(crayons$silver_swirls)
plot(crayons$standard)
plot(crayons$standard16)
plot(crayons$standard24)
plot(crayons$standard32)
plot(crayons$standard64)
plot(crayons$star_brite)

Heuristics for Color Distances and Locations

Description

  • pick_colors() places each color into RGB space, clusters them with k-means, and returns the colors nearest each cluster center.

  • color_order() reorders colors so that subsequent colors are far from each other in RGB space.

  • color_distance() calculates pairwise distances in RGB space between colors.

Usage

pick_colors(hex, n)

color_distance(hex)

color_order(hex)

Arguments

hex

a character vector of hexadecimal colors

n

the integer number of desired colors

Value

a character vector that is a subset of hex, or a matrix of distances for color_distance()

Examples

pick_colors(crayons$standard, 10)
color_order(crayons$standard)
color_distance(crayons$standard[1:4])

Crayon Color Scales for ggplot2

Description

Crayon Color Scales for ggplot2

Usage

scale_color_crayons(palette = "standard16", which = NULL, ..., reverse = FALSE)

scale_fill_crayons(palette = "standard16", which = NULL, ..., reverse = FALSE)

scale_colour_crayons(
  palette = "standard16",
  which = NULL,
  ...,
  reverse = FALSE
)

Arguments

palette

palette from names(crayons) to use

which

numeric indices of colors to use. NULL by default.

...

arguments passed on to ggplot2::discrete_scale()

reverse

Should the vector be reversed? Default is FALSE.

Value

A ggplot2::Scale

Examples

library(ggplot2)
ggplot2::mpg |>
  ggplot() +
   geom_point(aes(displ, hwy, colour = class)) +
   scale_color_crayons(palette = 'original')

ggplot2::mpg |>
  ggplot() +
   geom_point(aes(displ, hwy, fill = class), pch = 23, color = 'transparent') +
   scale_fill_crayons(palette = 'original')