Skip to main content

Module color

Module color 

Source
Expand description

Color palette generation functions โ€” rainbow(), heat.colors(), terrain.colors(), topo.colors(), cm.colors(), gray.colors(), hsv(), hcl(), and colorRampPalette().

Staticsยง

__BUILTIN_REG_BUILTIN_CM_COLORS ๐Ÿ”’
__BUILTIN_REG_BUILTIN_COLOR_RAMP_INTERP ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GRAY_COLORS ๐Ÿ”’
__BUILTIN_REG_BUILTIN_GREY ๐Ÿ”’
__BUILTIN_REG_BUILTIN_HCL ๐Ÿ”’
__BUILTIN_REG_BUILTIN_HEAT_COLORS ๐Ÿ”’
__BUILTIN_REG_BUILTIN_HSV ๐Ÿ”’
__BUILTIN_REG_BUILTIN_RAINBOW ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TERRAIN_COLORS ๐Ÿ”’
__BUILTIN_REG_BUILTIN_TOPO_COLORS ๐Ÿ”’
__INTERP_REG_INTERP_COLOR_RAMP_PALETTE ๐Ÿ”’

Functionsยง

builtin_cm_colors ๐Ÿ”’
Generate a cyan-magenta diverging color palette.
builtin_color_ramp_interp ๐Ÿ”’
Internal helper: interpolate between a vector of hex colors to produce n colors.
builtin_gray_colors ๐Ÿ”’
Generate a gray-scale color palette.
builtin_grey ๐Ÿ”’
Convert grey levels to hex color strings.
builtin_hcl ๐Ÿ”’
Convert HCL (Hue-Chroma-Luminance) color values to hex color strings.
builtin_heat_colors ๐Ÿ”’
Generate a heat map color palette (red through yellow to white).
builtin_hsv ๐Ÿ”’
Convert HSV color values to hex color strings.
builtin_rainbow ๐Ÿ”’
Generate a rainbow color palette using HSV color space.
builtin_terrain_colors ๐Ÿ”’
Generate a terrain color palette (green through yellow/brown to white).
builtin_topo_colors ๐Ÿ”’
Generate a topographic color palette (blue through green to yellow).
double_scalar ๐Ÿ”’
Extract a scalar f64 from an RValue, returning a default if NULL or missing.
extract_doubles ๐Ÿ”’
Extract a vector of doubles from named/positional arg, defaulting to a single-element vector.
extract_n ๐Ÿ”’
Extract n (first positional arg, required) as a non-negative integer.
hcl_to_rgb ๐Ÿ”’
Convert HCL (Hue in degrees, Chroma, Luminance) to RGB (each in [0,1]). Uses the CIE LCH -> Lab -> XYZ -> sRGB pipeline.
hsv_to_rgb ๐Ÿ”’
Convert HSV (h in [0,1], s in [0,1], v in [0,1]) to RGB (each in [0,1]).
interp_color_ramp_palette ๐Ÿ”’
Create a color interpolation function from a vector of colors.
parse_hex_color ๐Ÿ”’
Parse a hex color string like โ€œ#RRGGBBโ€ or โ€œ#RRGGBBAAโ€ into (r, g, b, a) with values in [0,1].
rgb_to_hex ๐Ÿ”’
Format (r, g, b, a) each in [0,1] as a hex color string. If alpha is 1.0, returns โ€œ#RRGGBBโ€; otherwise โ€œ#RRGGBBAAโ€.