diff --git a/src/components/PaintControls.vue b/src/components/PaintControls.vue index d2fe8cc54..166105f4c 100644 --- a/src/components/PaintControls.vue +++ b/src/components/PaintControls.vue @@ -134,10 +134,13 @@ export default defineComponent({ }); const setBrushColor = (color: string) => { - const hexa = `${color}FF`.toUpperCase(); - if (hexa in hexToValue) { - paintStore.setBrushValue(hexToValue[hexa]); + const withAlpha = color.length === 9 ? color : `${color}FF`; + const hexa = withAlpha.toUpperCase(); + const brushValue = hexToValue[hexa]; + if (brushValue == null) { + throw new Error(`Brush value invalid`); } + paintStore.setBrushValue(brushValue); }; const brushSize = computed(() => paintStore.brushSize);