read_soc: Read colors from OpenOffice Palette (SOC) files

Description Usage Arguments Note Examples

Description

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

Usage

1
read_soc(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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# built-in palette
soc_file <- system.file("palettes", "ccooo.soc", package="swatches")
system(sprintf("cat %s", soc_file))
ccooo <- read_soc(soc_file)
print(ccooo)
show_palette(ccooo)

# from the internet directly
## Not run: 
galaxy <- read_soc("https://www.openoffice.org/ui/VisualDesign/docs/colors/galaxy.soc")
print(galaxy)
show_palette(galaxy)

## End(Not run)

swatches documentation built on May 1, 2019, 8:05 p.m.

Related to read_soc in swatches...