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

View source: R/col_to_rgb.R

col_to_intR Documentation

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)

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".

Value

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

Examples

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

colorfast documentation built on April 4, 2025, 1:03 a.m.