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 |
Convert colours-as-strings to packed integer colours for nativeRasters
col_to_packed_int(col)
col_to_packed_int(col)
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". |
integer vector
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.
col_to_rgb(col)
col_to_rgb(col)
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". |
col_to_rgb(c("hotpink", "#abc", "#aabb99", "#aabb9980"))
col_to_rgb(c("hotpink", "#abc", "#aabb99", "#aabb9980"))