Extracts the hexadecimal value from a string that starts with a "#" character.
getHexValue("#ff00ff")// => { ok: true, value: 'ff00ff' } Copy
getHexValue("#ff00ff")// => { ok: true, value: 'ff00ff' }
Handle invalid input:
getHexValue("ff0000")// => { ok: false, error: Error('[colors.getHexValue] Expected a valid hex string') } Copy
getHexValue("ff0000")// => { ok: false, error: Error('[colors.getHexValue] Expected a valid hex string') }
The string to extract the hexadecimal value from.
A Result object with either the hexadecimal value as string on success, or an Error object if the provided input is not a string.
Result
Error
Generated using TypeDoc v0.24.7
Extracts the hexadecimal value from a string that starts with a "#" character.
Example
Example
Handle invalid input: