Package 'colourlookup'

Title: Fast Conversion of Hex Colours and R Colour Names to Integer Arrays of RGBA Values and Packed Integer Native Format
Description: Fast lookup of rgb values for R colour names using an order-preserving minimal perfect hash. Also includes fast lookup of RGBA values for hexadecimal colours.
Authors: Mike Cheng [aut, cre, cph]
Maintainer: Mike Cheng <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1.9003
Built: 2024-11-07 12:23:10 UTC
Source: https://github.com/coolbutuseless/colourlookup

Help Index


Convert colours-as-strings to packed integer colours for nativeRasters

Description

Convert colours-as-strings to packed integer colours for nativeRasters

Usage

col_to_packed_int(col)

Arguments

col

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

Value

integer vector


Convert colours-as-strings to a matrix of RGBA integers

Description

This is a proof-of-concept drop-in replacement for grDevices::col2rgb() which uses an order-preserving minimal perfect hash to lookup R colour names.

Usage

col_to_rgb(col)

Arguments

col

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

Examples

col_to_rgb(c("hotpink", "#abc", "#aabb99", "#aabb9980"))