Package 'lepidochroma'

Title: Colour Palettes Inspired by Butterflies
Description: A collection of colour palettes inspired by some of our dearest butterfly species. This package provides continuous and categorical palettes, including some colour blind friendly options.
Authors: Sara Gamboa [aut, cre] (ORCID: <https://orcid.org/0000-0002-0829-3747>), Adrián Castro Insua [aut] (ORCID: <https://orcid.org/0000-0003-4184-8641>), Sofía Galván [aut] (ORCID: <https://orcid.org/0000-0002-3092-4314>), Graciela Sotelo [aut] (ORCID: <https://orcid.org/0000-0002-0577-6655>), Marta Matamala-Pagès [aut] (ORCID: <https://orcid.org/0009-0002-3435-9356>), Adriana Oliver [aut] (ORCID: <https://orcid.org/0000-0002-2583-8294>), Iván Rey-Rodríguez [aut] (ORCID: <https://orcid.org/0000-0002-7253-5552>), Eduardo Méndez-Quintas [aut] (ORCID: <https://orcid.org/0000-0001-8272-873X>), Sara Varela [aut] (ORCID: <https://orcid.org/0000-0002-5756-5737>)
Maintainer: Sara Gamboa <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2026-05-15 06:58:51 UTC
Source: https://github.com/cran/lepidochroma

Help Index


Colour palettes inspired by butterflies

Description

Returns a colour palette from the lepidochroma collection.

Usage

lepidochroma(name, n = NULL)

Arguments

name

Palette name (see the name column in the data frame returned by lepidochroma_palettes() for a list of available options). This argument is case insensitive.

n

Number of colours to return. It is an optional argument: if it is not specified, all available colours for the specified palette will be returned. For continuous palettes (see the output of lepidochroma_palettes()) this parameter can take any number >= 2. For discrete palettes, its maximum value is limited to their number of colours.

Value

A character vector with colours as hexadecimal strings.

Examples

# Discrete palette
lepidochroma("attacus", 4)
# Continuous palette
lepidochroma("morpho", 30)

Palette preview

Description

Displays a preview of a palette or a set of palettes with the specified number of colours in a plot.

Usage

lepidochroma_display(
  name = NULL,
  n = NULL,
  type = c("all", "discrete", "continuous"),
  colourblind_only = FALSE
)

Arguments

name

Palette name (see the name column in the data frame returned by lepidochroma_palettes() for a list of available options). This argument is case insensitive. If it is not specified, all palettes matching the properties indicated in the type and colourblind_only arguments will be displayed.

n

Number of colours to display. It is an optional argument, if it is not specified, the plot will display all the available colours.

type

The type of palettes to be displayed ("all", "discrete", or "continuous"). This argument is ignored if name is specified. It defaults to "all".

colourblind_only

A logical value. If TRUE, display only colour blind friendly palettes. This argument is ignored if name is specified. It defaults to FALSE.

Value

No return value, called for side effects.

Examples

# Discrete palette
lepidochroma_display("parthenos", 3)
# Continuous palette
lepidochroma_display("battus", 30)

Get information on available palettes

Description

Returns a data frame with the names and information on the palettes that are available in the package.

Usage

lepidochroma_palettes()

Value

A data frame with 3 variables:

  • name: palette name

  • n_colours: number of colours in the palette

  • type: continuous or discrete

  • colourblind_friendly: a logical value indicating if the palette is colour blind friendly

Examples

lepidochroma_palettes()