Learn R Programming

colorfast (version 1.0.1)

col_to_int: Fast conversion of colors-as-strings to an integer vector of packed RGBA values.

Description

Packed RGBA values are used in R's native raster objects.

Usage

col_to_int(col)

Value

Integer vector where the 4 bytes making up each integer represent the RGBA values of the color

Arguments

col

Character vector of color names. Supports all R color names (e.g. "red", "hotpink") and hex colors of the form: "#RRGGBBAA", "#RRGGBB", "#RGBA" and "#RGB".

Examples

Run this code
col_to_int(c("hotpink", "#abc", "#abcd", "#aabb99", "#aabb9980"))

Run the code above in your browser using DataLab