Converts a hex color to its red, green and blue values.
A 3- or 6-digit hex color, such as #f80 or #ff8800. The leading # is optional, and case doesn't matter.
#f80
#ff8800
#
The color's channels, each from 0 to 255.
If hexCode isn't a 3- or 6-digit hex color.
hexCode
hexToRgb('#ff8000'); // { r: 255, g: 128, b: 0 }hexToRgb('fff'); // { r: 255, g: 255, b: 255 } Copy
hexToRgb('#ff8000'); // { r: 255, g: 128, b: 0 }hexToRgb('fff'); // { r: 255, g: 255, b: 255 }
Converts a hex color to its red, green and blue values.