Skip to main content

Module color

Module color 

Source
Expand description

R color system — 657 named colors, hex parsing, color builtins.

The named color table matches R’s colors() output exactly, including all X11/CSS colors and the gray0–gray100 / grey0–grey100 series. Lookup is case-insensitive via binary search on lowercase names.

Structs§

RColor
An RGBA color value. Alpha defaults to 255 (fully opaque).

Constants§

DEFAULT_PALETTE
R’s default palette: c(“black”,“red”,“green3”,“blue”,“cyan”,“magenta”,“yellow”,“gray”)
NAMED_COLORS
All 657 R named colors, sorted alphabetically for binary search. Generated from R’s colors() output and col2rgb() values.

Statics§

__BUILTIN_REG_BUILTIN_COLORS 🔒
__BUILTIN_REG_BUILTIN_RGB 🔒
__INTERP_REG_INTERP_COL2RGB 🔒
__INTERP_REG_INTERP_PALETTE 🔒

Functions§

builtin_colors 🔒
Return a character vector of all 657 named color names.
builtin_rgb 🔒
Create hex color strings from RGB(A) values.
clamp_to_u8 🔒
Clamp a floating-point value to 0–255 and round to nearest u8.
default_palette
Returns the default palette as a Vec<RColor>.
get_double_vec 🔒
Extract a vector of f64 from an RValue, for use in rgb().
interp_col2rgb 🔒
Convert color specifications to RGB values.
interp_palette 🔒
Get or set the color palette.