One bound of the range, as a 3- or 6-digit hex color. The leading #
is optional. Defaults to #000000 (black).
The other bound, as a 3- or 6-digit hex color. The leading # is
optional. Defaults to #ffffff (white). If a channel of minColor is the higher one,
the bounds for that channel are swapped.
A random 6-character hexadecimal color code with leading #,
where each RGB component falls within the specified range.
// Generate any color in the full spectrum
generateRandomHexColorInRange('#000000', '#ffffff');
// => '#7a3f2c' (or any random hex color)
// Generate a shade of blue
generateRandomHexColorInRange('#000066', '#0000ff');
// => '#0000a3'
// Generate warm colors (reds/oranges)
generateRandomHexColorInRange('#800000', '#ff8800');
// => '#c24510'
Generates a random hexadecimal color code within a specified RGB range.
Creates a random color where each RGB component is independently randomized between the corresponding components of the two colors. This is useful for generating colors within a specific color palette or theme.