|
13 | 13 | script.defer = true;
|
14 | 14 | document.head.appendChild(script);
|
15 | 15 |
|
16 |
| - // Add custom styles for purple color |
| 16 | + // Add custom styles for purple color and rounded corners |
17 | 17 | const style = document.createElement('style');
|
18 | 18 | style.textContent = `
|
19 | 19 | #dify-chatbot-bubble-button {
|
20 | 20 | background-color: #4B39EF !important;
|
21 | 21 | bottom: 0.25rem !important;
|
22 | 22 | right: 0.25rem !important;
|
| 23 | + border-radius: 50% !important; |
| 24 | + width: 50px !important; |
| 25 | + height: 50px !important; |
| 26 | + } |
| 27 | + |
| 28 | + /* Make the main chat window background more translucent to show rounded corners */ |
| 29 | + .dify-chatbot-widget #dify-chatbot-bubble-window { |
| 30 | + background-color: rgba(51, 51, 51, 0.6) !important; |
| 31 | + border-radius: 12px !important; |
| 32 | + overflow: hidden !important; |
| 33 | + } |
| 34 | + |
| 35 | + /* Also target any main container backgrounds */ |
| 36 | + .dify-chatbot-widget > div { |
| 37 | + background-color: rgba(51, 51, 51, 0.6) !important; |
| 38 | + border-radius: 12px !important; |
| 39 | + overflow: hidden !important; |
| 40 | + } |
| 41 | + |
| 42 | + /* Target the main chat container */ |
| 43 | + .dify-chatbot-widget .dify-chatbot-bubble-window { |
| 44 | + background-color: rgba(51, 51, 51, 0.6) !important; |
| 45 | + border-radius: 12px !important; |
| 46 | + overflow: hidden !important; |
| 47 | + } |
| 48 | + |
| 49 | + /* Target any chat window elements */ |
| 50 | + [id*="chat"], [class*="chat-window"], [class*="bubble-window"] { |
| 51 | + background-color: rgba(51, 51, 51, 0.6) !important; |
| 52 | + border-radius: 12px !important; |
| 53 | + overflow: hidden !important; |
| 54 | + } |
| 55 | + |
| 56 | + /* Ensure the chat button is perfectly circular */ |
| 57 | + [id*="bubble-button"], [class*="bubble-button"] { |
| 58 | + border-radius: 50% !important; |
| 59 | + width: 60px !important; |
| 60 | + height: 60px !important; |
23 | 61 | }
|
24 | 62 | `;
|
25 | 63 | document.head.appendChild(style);
|
|
88 | 126 | element.style.left = 'auto';
|
89 | 127 | }
|
90 | 128 | });
|
| 129 | + |
| 130 | + // Make background elements more translucent to show rounded corners |
| 131 | + const allElements = document.querySelectorAll('.dify-chatbot-widget *'); |
| 132 | + allElements.forEach(element => { |
| 133 | + const computedStyle = window.getComputedStyle(element); |
| 134 | + // Look for dark backgrounds that are likely the main content area |
| 135 | + if (computedStyle.backgroundColor && |
| 136 | + (computedStyle.backgroundColor.includes('rgb(51, 51, 51)') || |
| 137 | + computedStyle.backgroundColor.includes('rgb(64, 64, 64)') || |
| 138 | + computedStyle.backgroundColor.includes('rgb(33, 33, 33)') || |
| 139 | + computedStyle.backgroundColor.includes('#333333') || |
| 140 | + computedStyle.backgroundColor.includes('#404040') || |
| 141 | + computedStyle.backgroundColor.includes('#212121'))) { |
| 142 | + // Make it more translucent |
| 143 | + element.style.backgroundColor = 'rgba(51, 51, 51, 0.5)'; |
| 144 | + element.style.borderRadius = '12px'; |
| 145 | + element.style.overflow = 'hidden'; |
| 146 | + } |
| 147 | + }); |
| 148 | + |
| 149 | + // Ensure chat button is circular |
| 150 | + const chatButtons = document.querySelectorAll('[id*="bubble-button"], [class*="bubble-button"]'); |
| 151 | + chatButtons.forEach(button => { |
| 152 | + button.style.borderRadius = '50%'; |
| 153 | + button.style.width = '60px'; |
| 154 | + button.style.height = '60px'; |
| 155 | + }); |
91 | 156 | }
|
92 | 157 |
|
93 | 158 | // Apply positioning after script loads
|
|
0 commit comments