diff --git a/src/Themes/ui/ColorPicker/index.tsx b/src/Themes/ui/ColorPicker/index.tsx index 29181deac..5f2ece727 100644 --- a/src/Themes/ui/ColorPicker/index.tsx +++ b/src/Themes/ui/ColorPicker/index.tsx @@ -35,7 +35,6 @@ type OpenColorPickerButtonProps = { }; function parseHEXtoRGB(hex: string): RGB { - if (hex.length == 4) { return { r: Number.parseInt(`${hex[1]}${hex[1]}`, 16), @@ -44,7 +43,15 @@ function parseHEXtoRGB(hex: string): RGB { }; } - if (hex.length == 7 || hex.length == 9) { + if (hex.length == 7) { + return { + r: Number.parseInt(`${hex[1]}${hex[2]}`, 16), + g: Number.parseInt(`${hex[3]}${hex[4]}`, 16), + b: Number.parseInt(`${hex[5]}${hex[6]}`, 16), + }; + } + + if (hex.length == 9) { return { r: Number.parseInt(`${hex[1]}${hex[2]}`, 16), g: Number.parseInt(`${hex[3]}${hex[4]}`, 16),