rgb2hex: Convert RGB values to HEX color codes

View source: R/rgb2hex.R

rgb2hexR Documentation

Convert RGB values to HEX color codes

Description

Convert an RGB triplet (or a list of triplets) to HEX color codes.

Usage

rgb2hex(rgb)

Arguments

rgb

A numeric vector of length 3 (e.g., c(255, 128, 0)), or a list of such vectors (e.g., list(c(255,128,0), c(0,255,0))).

Value

A HEX color string if a single RGB vector is provided, or a character vector of HEX codes if a list is provided.

Examples

rgb2hex(c(255, 128, 0))                           # "#FF8000"
rgb2hex(list(c(255,128,0), c(0,255,0)))           # c("#FF8000", "#00FF00")

evanverse documentation built on March 10, 2026, 5:07 p.m.