Package 'glyospalettes'

Title: Color Palettes Inspired by Glyos Colorways
Description: Color palettes based on the named colorways of the Glyos toy system: Onell Design's Glyos System Series and the Glyos-compatible lines from partner companies such as TheGodBeast, Spy Monkey Creations, Toyfinity and the Four Horsemen. Includes 'ggplot2' color and fill scales for discrete and continuous data, metadata linking each palette to its company and product line, helpers to shortlist palettes that suit categorical, color-blind-safe, sequential or diverging use, and tools to combine palettes (one color per colorway) or pick the most distinguishable colors from a pool for a light, dark or grayscale plot. Hex values are approximations curated from product photography. This is a fan project and is not affiliated with or endorsed by any of the companies.
Authors: Brian Maitner [aut, cre]
Maintainer: Brian Maitner <[email protected]>
License: MIT + file LICENSE
Version: 0.3.0
Built: 2026-10-28 00:00:58 UTC
Source: https://github.com/cran/glyospalettes

Help Index


Glyos colorway metadata

Description

Background information for every palette in glyos_palettes: the company and product line it comes from, the colorway name as the manufacturer uses it, the year and wave of the reference release where known, a plain-language description of the colors, the reference figure whose photograph the palette was sampled from, and a link to that figure's entry in the Official Glyos Database (Onell Design) or the Glyos Wiki (partner companies).

Usage

glyos_colorways

Format

A data frame with one row per palette and the columns:

palette

Palette name, as used by glyos_palette().

company

Company that produced the colorway, e.g. "Onell Design" or "TheGodBeast". See glyos_companies().

line

Product line, e.g. "Glyos", "Kabuto Mushi" or "Battle Tribes".

colorway

Colorway or figure name as used by the manufacturer.

year

Year of the reference release, or NA where not recorded.

wave

Release wave or series of the reference release, or NA.

n_colours

Number of colors in the palette.

description

Description of the plastic and paint colors.

reference_figure

Figure the palette was sampled from.

source

URL of the reference figure's page.

image

Direct URL of the reference photograph the palette was sampled from, hosted by the Official Glyos Database or the Glyos Wiki.

Source

Official Glyos Database, https://database.glyos.com/; the Glyos Transmission Web Log, https://onelldesign.blogspot.com/; and the Glyos Wiki (glyos.fandom.com).

Examples

head(glyos_colorways)
table(glyos_colorways$company)
subset(glyos_colorways, company == "TheGodBeast", c(palette, colorway))

Combine palettes: one color from each of a set of colorways

Description

Takes one color from each named palette, or from every palette of a company or product line, and returns them as a single categorical palette named by the colorway each color came from. This is the quick way to get "one color per Kabuto Mushi" or "one color per Battle Tribes figure".

Usage

glyos_combine(
  palettes = NULL,
  company = NULL,
  line = NULL,
  which = 1L,
  distinct = FALSE
)

Arguments

palettes

Character vector of palette names; see glyos_palette_names(). May be omitted when company or line is given.

company, line

Optional filters passed to glyos_palette_names(); every matching palette contributes one color.

which

Which color to take from each palette (1 is the main plastic color). Palettes with fewer colors contribute their last one.

distinct

Logical. Choose each palette's contribution to be as different as possible from those already chosen, instead of position which?

Details

By default the first color of each palette is used, which is the main plastic color and so is faithful to each figure but can repeat across a line cast from shared plastics. distinct = TRUE instead picks, for each palette in turn, the color from that palette that is farthest (in CIE Lab) from the colors already chosen, which keeps the result legible on a chart at some cost to fidelity. For a stricter selection that also drops colors with poor contrast against the background, see glyos_pick().

Value

A named character vector of hex colors with class "glyos_palette", one per palette, in the order of palettes or of glyos_palette_names(). Pass unname()d to ggplot2::scale_colour_manual().

See Also

glyos_pick(), glyos_palette()

Examples

glyos_combine(c("standard", "spectre", "hades", "infection", "glyaxia"))
glyos_combine(line = "Kabuto Mushi")
glyos_combine(line = "Kabuto Mushi", distinct = TRUE)
glyos_combine(company = "Toyfinity", which = 2)

library(ggplot2)
ggplot(mpg, aes(displ, hwy, color = drv)) +
  geom_point(size = 2.5) +
  scale_colour_manual(values = unname(glyos_combine(c("glyaxia", "hades", "infection"))))

List the companies with palettes in glyospalettes

Description

List the companies with palettes in glyospalettes

Usage

glyos_companies()

Value

A character vector of company names, sorted with Onell Design first, that can be passed to the company argument of glyos_palette_names() and glyos_show_palettes().

Examples

glyos_companies()

Credit the designers of the colorways behind a plot

Description

Builds a short attribution sentence naming the colorways used and the companies that designed them, suitable for a figure caption or an acknowledgments section. Naming the designer of a color scheme is ordinary factual attribution; the longer form also states that the colors are approximations and imply no endorsement, which is the wording journals tend to want.

Usage

glyos_credit(
  x,
  format = c("caption", "acknowledgment", "markdown"),
  package = TRUE
)

Arguments

x

What to credit: a palette name, a character vector of names, or a glyos_palette object. Objects from glyos_pick() and glyos_combine() carry their source palettes, so the credit covers every colorway that contributed a color.

format

One of:

"caption"

One sentence for a figure caption, e.g. ⁠Colors: Vice Knight colorway by Toy Pizza (Knights of the Slice), via the glyospalettes R package.⁠

"acknowledgment"

Two sentences in the register of an acknowledgments section, naming the designers and stating that the hex values are approximations that imply no endorsement.

"markdown"

The caption with each colorway linked to its reference page, for R Markdown, Quarto or pkgdown captions.

package

Logical. Mention the glyospalettes package? Set to FALSE when the package is cited elsewhere in the text.

Value

A single character string.

See Also

glyos_colorways for the underlying metadata; citation("glyospalettes") for the package reference.

Examples

glyos_credit("kots_vice_knight")
glyos_credit(c("glyaxia", "hades", "kabuto_infection"))
glyos_credit(glyos_pick(c("glyaxia", "kabuto_infection"), n = 4))
glyos_credit("glyaxia", format = "acknowledgment")
cat(glyos_credit(c("glyaxia", "wom_empyreus"), format = "markdown"))

library(ggplot2)
ggplot(mpg, aes(displ, hwy, color = drv)) +
  geom_point(size = 2.5) +
  scale_color_glyos("glyaxia") +
  labs(caption = glyos_credit("glyaxia"))

Find Glyos palettes that suit a plotting use case

Description

Filters the palettes to those whose colors work for a given job, judged from the perceptual statistics in glyos_palette_stats(). Many colorways look great on a figure but poor on a chart; this surfaces the ones that hold up.

Usage

glyos_find_palettes(
  use = c("categorical", "colorblind", "sequential", "diverging"),
  company = NULL,
  line = NULL,
  min_colours = 4
)

Arguments

use

One of:

"categorical"

Every pair of colors is clearly distinguishable (minimum Lab distance of 20 or more). Good for unordered groups.

"colorblind"

Categorical, and still distinguishable under simulated deuteranopia, protanopia and tritanopia (minimum distance 15 or more in each).

"sequential"

One hue family (hue spread of 45 degrees or less among the chromatic colors) spanning at least 50 units of lightness, so a continuous gradient reads as low-to-high. Pair with sort = TRUE in glyos_palette() or the ⁠_c⁠ scales.

"diverging"

Exactly two distinct hue families plus a light or neutral color to sit between them. The curated order is not necessarily dark-A, light, dark-B; check glyos_palette_stats() and reorder the colors yourself for a continuous diverging scale.

The thresholds are deliberately simple heuristics computed by glyos_palette_stats(); treat the result as a shortlist to look at with glyos_show_palettes(), not a guarantee.

company, line

Optional filters passed to glyos_palette_names().

min_colours

Minimum number of colors the palette must have.

Value

A character vector of palette names, ordered so that the strongest candidates for the use case come first.

Examples

glyos_find_palettes("colorblind")
glyos_find_palettes("diverging", company = "Onell Design")
glyos_find_palettes("sequential")

Get colors from a Glyos colorway

Description

Returns n colors from the named colorway, either the first n curated colors (type = "discrete") or n colors interpolated across the whole palette (type = "continuous").

Usage

glyos_palette(
  name,
  n = NULL,
  type = c("discrete", "continuous"),
  strict = TRUE,
  sort = FALSE
)

Arguments

name

Palette name. Case-insensitive; see glyos_palette_names().

n

Number of colors wanted. Defaults to every color in the palette.

type

Either "discrete" (default) to return the curated colors as they are, or "continuous" to interpolate n colors across the palette with grDevices::colorRampPalette().

strict

Logical. For discrete palettes, error when n exceeds the number of curated colors (default). If FALSE, interpolate to n colors instead.

sort

Logical. If TRUE, order the colors from darkest to lightest (by CIE lightness) before selecting or interpolating. Useful when a palette is used as a sequential gradient; see glyos_find_palettes().

Value

A character vector of hex colors with class "glyos_palette", which has a print method that draws the swatches.

Examples

glyos_palette("spectre")
glyos_palette("glyaxia", 3)
glyos_palette("hades", 12, type = "continuous")
glyos_palette("hades", 12, type = "continuous", sort = TRUE)
glyos_palette("wom_empyreus")

# base graphics
barplot(1:5, col = glyos_palette("gatekeeper"))

List the available Glyos palettes

Description

List the available Glyos palettes

Usage

glyos_palette_names(company = NULL, line = NULL)

Arguments

company

Optional company name (see glyos_companies()) to restrict the list to. Matched case-insensitively and by unique prefix, so "godbeast" and "spy monkey" work.

line

Optional product line (see the line column of glyos_colorways) to restrict the list to, matched the same way.

Value

A character vector of palette names accepted by glyos_palette() and the ⁠scale_*_glyos()⁠ functions.

Examples

glyos_palette_names()
glyos_palette_names(company = "TheGodBeast")
glyos_palette_names(line = "Battle Tribes")

Perceptual statistics for every Glyos palette

Description

Computes, from the hex colors alone, how suitable each palette is for the common plotting jobs. Used by glyos_find_palettes(); exposed so you can apply your own thresholds.

Usage

glyos_palette_stats(names = glyos_palette_names())

Arguments

names

Palette names to compute for. Defaults to all palettes.

Details

Distances are CIE76 (Euclidean in CIE Lab). Color-vision deficiency is simulated with the Machado, Oliveira and Fernandes (2009) matrices at full severity for deuteranopia, protanopia and tritanopia. Hue statistics only consider colors with chroma of at least 20, so grays and blacks do not count as a hue.

Value

A data frame with one row per palette and the columns:

palette

Palette name.

n_colours

Number of colors.

min_de

Smallest pairwise Lab distance between any two colors. Larger is easier to tell apart; 20 is a comfortable floor for categorical use.

min_de_deutan, min_de_protan, min_de_tritan

The same after simulating each color-vision deficiency.

lum_range

Range of CIE lightness (0 to 100) across the palette.

hue_spread

Angular spread of the chromatic colors' hues, in degrees. Near 0 means one hue family.

hue_clusters

Number of distinct hue families (hues separated by more than 60 degrees).

has_light

Whether the palette contains a light or neutral color that can serve as a midpoint.

categorical, colorblind, sequential, diverging

Logical flags as used by glyos_find_palettes().

Examples

s <- glyos_palette_stats()
head(s[order(-s$min_de_deutan), c("palette", "min_de", "min_de_deutan")])

Glyos colorway palettes

Description

A named list of color palettes, one per colorway, covering Onell Design's Glyos line and the Glyos-compatible lines from partner companies such as TheGodBeast, Spy Monkey Creations, Toyfinity and the Four Horsemen. Each element is a character vector of two to six hex colors holding only the plastic and paint colors of that colorway, ordered so that the first few colors are the most distinct from one another (body color first, then secondary plastic, then paint accents). Use glyos_palette() to pull colors from a palette and glyos_colorways for background on each colorway, including which company made it.

Usage

glyos_palettes

Format

A named list of character vectors of hex colors.

Details

Hex values are approximations. Onell Design palettes were sampled from the reference product photograph in the Official Glyos Database (https://database.glyos.com/) and adjusted against Onell's published color descriptions. Partner-company palettes were sampled from the lead photograph of the figure's page on the Glyos Wiki (glyos.fandom.com). Clear, glow-in-the-dark, metallic and pearlescent plastics cannot be captured by a single flat color; those palettes reflect how the plastic photographs.

See Also

glyos_palette(), glyos_palette_names(), glyos_companies(), glyos_colorways, glyos_show_palettes()

Examples

length(glyos_palettes)
glyos_palettes$spectre
glyos_palettes$kabuto_infection

Pick the most distinguishable colors from one or more palettes

Description

Pools the colors of the named palettes and selects the n that are hardest to confuse with one another on a given kind of plot: light background, dark background, or output that will be read in grayscale. Optionally judges distinctness under simulated color-vision deficiency. Use it when a single colorway does not have enough usable colors, or when you want a company's or a product line's colors but only the ones that hold up on a chart.

Usage

glyos_pick(
  palettes = NULL,
  n = 5,
  style = c("light", "dark", "grayscale", "greyscale"),
  colorblind = FALSE,
  company = NULL,
  line = NULL,
  background = NULL,
  min_contrast = 3
)

Arguments

palettes

Character vector of one or more palette names; see glyos_palette_names(). May be omitted when company or line is given.

n

Number of colors wanted.

style

One of "light" (white background), "dark" (near-black background) or "grayscale" (white background, judged by lightness alone). "greyscale" is accepted as a spelling alias.

colorblind

Logical. Require the colors to stay distinct under simulated deuteranopia, protanopia and tritanopia?

company, line

Optional filters passed to glyos_palette_names(); every matching palette is added to the pool.

background

Optional background color overriding the one implied by style, as a hex string.

min_contrast

Minimum WCAG 2 contrast ratio a color must have against the background to be considered. Set to 1 to disable the filter.

Details

The selection runs in three steps.

  1. Pool. The colors of every palette in palettes (plus every palette matching company and line, if given) are combined, with duplicates removed.

  2. Filter for the background. Colors whose WCAG 2 contrast ratio against the background is below min_contrast are dropped, so a light-mode selection never contains a near-white and a dark-mode selection never contains a near-black. The background is white for "light" and "grayscale" and near-black ("#121212") for "dark" unless background is given. The default of 3 is the WCAG minimum for graphical objects; lower it to keep more colors, raise it for text.

  3. Choose. Every pair of remaining colors is scored by its distance in CIE Lab (CIE76). With colorblind = TRUE the distance is the smallest of the normal-vision distance and the distances after simulating deuteranopia, protanopia and tritanopia (Machado, Oliveira and Fernandes 2009), so two colors only count as distinct if every viewer can tell them apart. With style = "grayscale" only the lightness difference counts, so the colors survive conversion to gray. The n colors whose closest pair is farthest apart are chosen (a maximum-dispersion subset, found exhaustively when the pool is small and by greedy seeding plus swap search otherwise), then ordered so that each color is as different as possible from those before it.

The result is a categorical palette: it does not try to build a gradient. The smallest pairwise distance in the selection is returned as the min_distance attribute; values above about 20 are comfortably distinct, and below about 12 two colors will be hard to tell apart. If the pool cannot supply n colors after filtering, the function errors and says how many it had, so add palettes or lower min_contrast.

Value

A character vector of n hex colors with class "glyos_palette", named by the palette each color came from, and with attributes min_distance (smallest pairwise distance under the chosen criterion), style, colorblind and background.

See Also

glyos_combine() to take one color from each of a set of palettes without filtering; glyos_find_palettes() to shortlist whole palettes; glyos_palette_stats() for the underlying measures.

Examples

# five colors for a white-background plot, from two classic colorways
glyos_pick(c("glyaxia", "hades"), n = 5)

# the same for a dark theme, and color-blind safe
glyos_pick(c("glyaxia", "hades"), n = 4, style = "dark", colorblind = TRUE)

# a whole product line, printable in grayscale
glyos_pick(line = "Kabuto Mushi", n = 4, style = "grayscale")

library(ggplot2)
cols <- glyos_pick(company = "Toyfinity", n = 3, colorblind = TRUE)
ggplot(mpg, aes(displ, hwy, color = drv)) +
  geom_point(size = 2.5) +
  scale_colour_manual(values = unname(cols)) +
  theme_minimal()

Display Glyos palettes

Description

Draws a swatch strip for each colorway on the current graphics device, labeled with the palette name and, by default, the hex code under each swatch. Useful for picking a colorway or for reporting a color that looks wrong. With no arguments every palette is drawn, which is a lot; filter by company, line or use to narrow it down.

Usage

glyos_show_palettes(
  names = NULL,
  company = NULL,
  line = NULL,
  use = NULL,
  ncol = 3,
  hex = TRUE
)

Arguments

names

Optional character vector of palette names to show. Defaults to every palette matching company, line and use.

company

Optional company name to restrict to; see glyos_companies().

line

Optional product line to restrict to; see the line column of glyos_colorways.

use

Optional use case to restrict to; see glyos_find_palettes().

ncol

Number of columns to arrange the swatch strips in.

hex

Logical. Print the hex code under each swatch?

Value

Invisibly, the character vector of palette names that were drawn.

Examples

glyos_show_palettes(company = "Onell Design")
glyos_show_palettes(company = "TheGodBeast", ncol = 2)
glyos_show_palettes(use = "colorblind", ncol = 4)
glyos_show_palettes(c("spectre", "hades", "infection"), ncol = 1)

Glyos color and fill scales for ggplot2

Description

Color and fill scales that use a Glyos colorway palette. The ⁠_d⁠ variants are for discrete data, the ⁠_c⁠ variants for continuous data, and scale_colour_glyos() / scale_fill_glyos() choose between the two with the discrete argument. ⁠scale_color_*⁠ spellings are aliases.

Usage

scale_colour_glyos_d(palette = "standard", reverse = FALSE, ...)

scale_fill_glyos_d(palette = "standard", reverse = FALSE, ...)

scale_colour_glyos_c(palette = "standard", reverse = FALSE, sort = FALSE, ...)

scale_fill_glyos_c(palette = "standard", reverse = FALSE, sort = FALSE, ...)

scale_colour_glyos(
  palette = "standard",
  discrete = TRUE,
  reverse = FALSE,
  sort = FALSE,
  ...
)

scale_fill_glyos(
  palette = "standard",
  discrete = TRUE,
  reverse = FALSE,
  sort = FALSE,
  ...
)

scale_color_glyos_d(palette = "standard", reverse = FALSE, ...)

scale_color_glyos_c(palette = "standard", reverse = FALSE, sort = FALSE, ...)

scale_color_glyos(
  palette = "standard",
  discrete = TRUE,
  reverse = FALSE,
  sort = FALSE,
  ...
)

Arguments

palette

Name of a Glyos colorway. See glyos_palette_names().

reverse

Logical. Reverse the order of colors in the palette?

...

Additional arguments passed on to ggplot2::discrete_scale() (discrete) or ggplot2::scale_colour_gradientn() / ggplot2::scale_fill_gradientn() (continuous).

sort

Logical, continuous scales only. Order the palette from darkest to lightest before building the gradient, so the scale reads as low-to-high. See glyos_find_palettes() for palettes that suit this.

discrete

Logical. If TRUE (default) build a discrete scale, otherwise a continuous gradient scale.

Details

Discrete scales draw the first n colors of the palette, where n is the number of levels in the data. If the data has more levels than the palette has colors, the palette is interpolated with grDevices::colorRampPalette() so that every level still receives a distinct color; expect the result to be less legible than the curated colors.

Value

A ggplot2 scale object.

Examples

library(ggplot2)

ggplot(mpg, aes(displ, hwy, color = class)) +
  geom_point(size = 3) +
  scale_colour_glyos("glyaxia")

ggplot(diamonds, aes(cut, fill = clarity)) +
  geom_bar() +
  scale_fill_glyos_d("gatekeeper")

ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
  geom_tile() +
  scale_fill_glyos_c("spectre")