From a8da6090454a1b1b9ca1d977138430f768ec44f1 Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Tue, 31 Dec 2024 01:05:36 -0500
Subject: Refactor BMIcon again

---
 extension/src/components/BMIcon.tsx | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'extension/src/components/BMIcon.tsx')

diff --git a/extension/src/components/BMIcon.tsx b/extension/src/components/BMIcon.tsx
index d8622fb..5e2f9c9 100644
--- a/extension/src/components/BMIcon.tsx
+++ b/extension/src/components/BMIcon.tsx
@@ -20,6 +20,12 @@ function BMIcon(props: {imgSrc?: string, bmUrl?:string}) {
         setIconMode("letter");
     }
 
+    if (!props.imgSrc) {
+        let url = new URL(props.bmUrl!);
+        bgColor = hashStringToColor(url.hostname)
+        iconMode = "letter"
+    }
+
     return (
         <div className={"icon-box " + (iconMode)}
              style={bgColor ? {"--icon-bg": `rgba(${bgColor[0]}, ${bgColor[1]}, ${bgColor[2]}, 0.2)`} as React.CSSProperties : undefined}>
-- 
cgit v1.2.3

