Fetches the color codes lookup table used for mapping raw RGB hex values to human-readable, purchasable color names. This enables translating technical color data into artist-friendly terminology matching popular art supply retailers.
Arguments
- cn
Database connection. If NULL (default), opens and closes a connection automatically via
artcore::dbc()/artcore::dbd().
Value
data.table with columns:
- hex
Character. Hex color code (e.g., "#FF5733")
- color
Character. Human-readable color name (e.g., "Burnt Sienna")
- r
Integer. Red component (0-255)
- g
Integer. Green component (0-255)
- b
Integer. Blue component (0-255)
Details
The color codes table maps hex colors to named colors that artists recognize and can purchase from art supply stores. This bridges the gap between technical RGB analysis and actionable artist insights.
The mapping uses RGB Euclidean distance to find the closest match:
sqrt((r1-r2)^2 + (g1-g2)^2 + (b1-b2)^2)
Data Source
Data is stored in app.color_codes table. The mapping is curated to align
with color names from major art supply brands.
See also
Other data-access:
art_has_nft(),
db-frame-analytics,
get_art_opensea_url(),
get_art_print_url(),
get_art_purchase_urls(),
get_artist_by_slug(),
get_artist_collections_summary(),
get_artist_index(),
get_artist_opensea(),
get_artist_recent_works(),
get_artist_stats(),
get_artist_style_map(),
get_artist_tags(),
get_artwork_index(),
get_artwork_meta(),
get_artwork_opensea(),
get_artwork_profile(),
get_artwork_profile_full(),
get_artwork_stats(),
get_verification_info()
Examples
if (FALSE) { # \dontrun{
# Fetch all color codes
colors <- get_color_codes()
# Use with existing connection
cn <- artcore::dbc()
colors <- get_color_codes(cn)
artcore::dbd(cn)
# Find closest match for a hex color
colors <- get_color_codes()
target_rgb <- grDevices::col2rgb("#FF5733")
colors[, dist := sqrt((r - target_rgb[1])^2 +
(g - target_rgb[2])^2 +
(b - target_rgb[3])^2)]
closest <- colors[which.min(dist)]
closest$color
} # }
