Red component value (0-255)
Green component value (0-255)
Blue component value (0-255)
Hexadecimal color string in format "#RRGGBB"
import { rgbToHex } from './colors.js';
// Convert primary colors
const red = rgbToHex(255, 0, 0); // "#ff0000"
const green = rgbToHex(0, 255, 0); // "#00ff00"
const blue = rgbToHex(0, 0, 255); // "#0000ff"
// Convert custom colors
const purple = rgbToHex(128, 0, 128); // "#800080"
const orange = rgbToHex(255, 165, 0); // "#ffa500"
// Use in web contexts
element.style.backgroundColor = rgbToHex(200, 150, 100);
getColorHex for direct fractal iteration to hex conversion
Converts RGB color values to hexadecimal color string format
This utility function transforms individual red, green, and blue components into a standard web-compatible hex color string for use in CSS, HTML, or other systems that expect hex color notation.