yania-n Claude Sonnet 4.6 commited on
Commit
cffdb58
·
1 Parent(s): 2549c59

Fix chatbot bubble visibility for Gradio 6

Browse files

Gradio 6 places .bot and .user classes directly on the bubble wrapper div,
not as .message.bot / .message.user combos. Old selectors never matched,
leaving Gradio's default light-coloured bubble backgrounds in place.

New selectors cover both the class-based (.bot/.user) and attribute-based
([data-testid]) patterns used across Gradio 6 versions. User bubbles get a
subtle green tint; bot bubbles get the dark surface-alt colour. All child
elements including prose and p tags are forced to pc-text colour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -225,13 +225,28 @@ button:not(.primary) {
225
  ul[role="listbox"] li,
226
  .option { color: var(--pc-text) !important; }
227
 
228
- /* === Chatbot === */
 
229
  .chatbot, .chatbot .wrap {
230
  background: var(--pc-surface) !important;
231
  border-color: var(--pc-border) !important;
232
  }
233
- .chatbot .message.bot { background: var(--pc-surface-alt) !important; }
234
- .chatbot .message.user { background: var(--pc-surface) !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
 
236
  /* === Plotly charts — override SVG text in light mode === */
237
  @media (prefers-color-scheme: light) {
 
225
  ul[role="listbox"] li,
226
  .option { color: var(--pc-text) !important; }
227
 
228
+ /* === Chatbot (Gradio 6) === */
229
+ /* Gradio 6 uses .bot / .user directly on the bubble div, not .message.bot */
230
  .chatbot, .chatbot .wrap {
231
  background: var(--pc-surface) !important;
232
  border-color: var(--pc-border) !important;
233
  }
234
+ .chatbot .bot,
235
+ .chatbot [data-testid="bot"] {
236
+ background: var(--pc-surface-alt) !important;
237
+ }
238
+ .chatbot .user,
239
+ .chatbot [data-testid="user"] {
240
+ background: rgba(74,222,128,0.12) !important;
241
+ }
242
+ /* Text inside all message bubbles */
243
+ .chatbot .bot *,
244
+ .chatbot .user *,
245
+ .chatbot [data-testid="bot"] *,
246
+ .chatbot [data-testid="user"] *,
247
+ .chatbot .prose,
248
+ .chatbot .prose p,
249
+ .chatbot p { color: var(--pc-text) !important; }
250
 
251
  /* === Plotly charts — override SVG text in light mode === */
252
  @media (prefers-color-scheme: light) {