Package {prakriti}


Title: Color Palettes Inspired by India's Natural Landscapes
Version: 0.1.4
Description: Curated color palettes drawn from India's natural beauty - Himalayan snow, Thar dunes, Kerala backwaters, Andaman reefs, Spiti's cold desert, Kashmir's autumn chinar, and more. Provides discrete and continuous palettes with first-class 'ggplot2' integration through scale_color_prakriti() and scale_fill_prakriti(), plus base graphics helpers for displaying palettes.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Depends: R (≥ 4.0)
Imports: grDevices, graphics, ggplot2 (≥ 3.4.0)
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown, pkgdown, patchwork
VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://orijitghosh.github.io/prakriti/, https://github.com/orijitghosh/prakriti
BugReports: https://github.com/orijitghosh/prakriti/issues
NeedsCompilation: no
Packaged: 2026-05-15 22:40:23 UTC; ariji
Author: Arijit Ghosh [aut, cre]
Maintainer: Arijit Ghosh <arijitghosh2009@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-20 08:40:02 UTC

prakriti: Color palettes inspired by India's natural landscapes

Description

30 hand-tuned color palettes drawn from India's biomes and geography - Himalayan snow, Thar dunes, Kerala backwaters, Andaman reefs, Spiti's cold desert, Kashmir's autumn chinar, and more. Includes ggplot2 scales, continuous interpolation, and base-graphics display helpers.

Main functions

Author(s)

Maintainer: Arijit Ghosh arijitghosh2009@gmail.com

See Also

Useful links:


Display one or all prakriti palettes

Description

Renders a base-graphics swatch view of one palette, or a stacked grid of all palettes. Useful for quick visual inspection in the R console / RStudio Plots pane.

Usage

display_prakriti(name = NULL, show_type = TRUE)

Arguments

name

Character or NULL. Name of the palette. If NULL (default), displays all 30 palettes stacked vertically.

show_type

Logical. If TRUE (default), includes the palette type (sequential, diverging, qualitative) in row labels. Must be TRUE or FALSE - to filter by type, use prakriti_info() instead.

Value

Invisibly returns NULL. Called for its side effect.

Examples

display_prakriti("rann")

display_prakriti()
display_prakriti(show_type = FALSE)



Tabular metadata for prakriti palettes

Description

Returns a data frame with one row per palette describing its name, type, length, and natural-landscape inspiration.

Usage

prakriti_info(name = NULL)

Arguments

name

Character or NULL. If supplied, restricts the result to the named palette(s). If NULL (default), returns all palettes.

Value

A data frame with columns name, type, n, inspiration.

Examples

prakriti_info()
prakriti_info("himalaya")

Names of available prakriti palettes

Description

Names of available prakriti palettes

Usage

prakriti_names()

Value

A character vector of palette names.

Examples

prakriti_names()

Build a color palette from a prakriti palette

Description

Returns a character vector of hex codes drawn from one of the named palettes in prakriti_palettes. Supports both discrete subsetting and continuous interpolation via grDevices::colorRampPalette().

Usage

prakriti_palette(
  name,
  n = NULL,
  type = c("discrete", "continuous"),
  direction = 1
)

Arguments

name

Character. Name of the palette. See prakriti_names().

n

Integer. Number of colors to return. If NULL (default), returns the full base palette unchanged.

type

Either "discrete" (subset / recycle base colors) or "continuous" (interpolate smoothly across the base colors).

direction

1 (default) or -1 to reverse the palette order.

Value

A character vector of hex codes with attributes name and type.

Examples

prakriti_palette("himalaya")
prakriti_palette("himalaya", n = 3)
prakriti_palette("himalaya", n = 50, type = "continuous")
prakriti_palette("thar", direction = -1)


Color palettes inspired by India's natural landscapes

Description

A named list of 30 palettes. Each element is itself a list with:

Usage

prakriti_palettes

Format

A named list of length 30.

Examples

names(prakriti_palettes)
prakriti_palettes$himalaya$colors

ggplot2 color and fill scales for prakriti palettes

Description

These functions plug prakriti palettes into ggplot2. By default the scale type (discrete vs. continuous) is chosen from the palette's metadata: qualitative palettes default to discrete; sequential and diverging palettes default to continuous. Override with discrete.

Usage

scale_color_prakriti(name, ..., discrete = NULL, direction = 1)

scale_colour_prakriti(name, ..., discrete = NULL, direction = 1)

scale_fill_prakriti(name, ..., discrete = NULL, direction = 1)

Arguments

name

Character. Name of the palette. See prakriti_names().

...

Additional arguments passed to the underlying ggplot2 scale constructor (ggplot2::discrete_scale(), ggplot2::scale_color_gradientn(), or ggplot2::scale_fill_gradientn()).

discrete

Logical or NULL. If NULL (default), inferred from the palette's type. Set TRUE to force discrete, FALSE for continuous.

direction

1 (default) or -1 to reverse the palette order.

Value

A ggplot2 scale object.

Examples


library(ggplot2)
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
  geom_point(size = 3) +
  scale_color_prakriti("valley_of_flowers")

ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
  geom_raster() +
  scale_fill_prakriti("himalaya")