Converts a hex color string to an RGB object.
The hex color string (with or without #).
An RGB object with r, g, b values (0-255).
// ES Moduleimport { hexToRgb } from '@bnidev/js-utils'// CommonJSconst { hexToRgb } = require('@bnidev/js-utils') Copy
// ES Moduleimport { hexToRgb } from '@bnidev/js-utils'// CommonJSconst { hexToRgb } = require('@bnidev/js-utils')
hexToRgb('#ff0000') // { r: 255, g: 0, b: 0 }hexToRgb('00ff00') // { r: 0, g: 255, b: 0 } Copy
hexToRgb('#ff0000') // { r: 255, g: 0, b: 0 }hexToRgb('00ff00') // { r: 0, g: 255, b: 0 }
Converts a hex color string to an RGB object.