Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: ColorPicker getColor (#5949)

zsviczian6273d5652448
diff --git a/src/components/ColorPicker.tsx b/src/components/ColorPicker.tsx
index 03ab4a5be9..cb05cf446a 100644
--- a/src/components/ColorPicker.tsx
+++ b/src/components/ColorPicker.tsx
@@ -66,10 +66,13 @@ const getColor = (color: string): string | null => {
return color;
}
- return isValidColor(color)
- ? color
- : isValidColor(`#${color}`)
+ // testing for `#` first fixes a bug on Electron (more specfically, an
+ // Obsidian popout window), where a hex color without `#` is (incorrectly)
+ // considered valid
+ return isValidColor(`#${color}`)
? `#${color}`
+ : isValidColor(color)
+ ? color
: null;
};