The object containing hex values for r, g, b, and optionally a, or a hex string.
An object containing decimal values for r, g, b, and optionally a.
const hexObj = { r: 'ff', g: '00', b: '00', a: '80' };
console.log(hexesToDecimals(hexObj)); // { r: 255, g: 0, b: 0, a: 0.5 }
const hexString = '#ff000080';
console.log(hexesToDecimals(hexString)); // { r: 255, g: 0, b: 0, a: 0.5 }
const shortHexString = '#f008';
console.log(hexesToDecimals(shortHexString)); // { r: 255, g: 0, b: 0, a: 0.53 }
Converts a HexObject or hex string to a HexDecimalObject by converting each hex value to its decimal equivalent. If the alpha (a) value is not provided, it defaults to 1.