read_gpl: Read colors from GIMP Palette (GPL) files

View source: R/gpl.R

read_gplR Documentation

Read colors from GIMP Palette (GPL) files

Description

Given a path or URL to an .gpl file, this function will return a named character vector (if color names are present) of hex RGB colors.

Usage

read_gpl(path, use_names = TRUE, .verbose = FALSE)

Arguments

path

partial or full file path or URL to a GPL file

use_names

add color names to the vector (defaults to TRUE). See NOTE

.verbose

show extra information about GPL file processing

Note

When using named color palettes in a ggplot2 scale_ context, you must unname, set use_names to FALSE or override their names to map to your own factor levels. Also, Neither Lab nor greyscale colors are supported.

Examples

# built-in palette
gimp16 <- read_gpl(system.file("palettes", "base16.gpl", package="swatches"))
print(gimp16)
show_palette(gimp16)

# from the internet directly
## Not run: 
bright <- read_gpl(URL)
print(bright)
show_palette(bright)

## End(Not run)

hrbrmstr/swatches documentation built on April 8, 2022, 3:59 p.m.