juancauma commited on
Commit
be15be7
·
1 Parent(s): e64fe73

changes to font color

Browse files
Files changed (2) hide show
  1. app.py +36 -76
  2. styles.css +23 -97
app.py CHANGED
@@ -35,41 +35,27 @@ class CustomTheme(gr.themes.Base):
35
  neutral_hue=colors.gray,
36
  text_size=gr.themes.sizes.text_lg
37
  )
38
- # Set up theme-level CSS variables
39
- self.block_background_fill = "transparent"
40
  self.block_border_width = "0px"
41
  self.block_shadow = "none"
42
- # Set color variables for all panel backgrounds
43
- self.background_fill_secondary = "#27272A" # Used for panels
44
 
45
- # Add additional CSS for the new styles
46
  custom_css += """
47
- /* Override Gradio theme variables */
48
- :root {
49
- --block-background-fill: transparent !important;
50
- --background-fill-primary: transparent !important;
51
- --background-fill-secondary: transparent !important;
52
- --panel-background-fill: #27272A !important;
53
- }
54
-
55
- /* Target Gradio's internal structure directly */
56
- .dark .block, .dark .gradio-container, .gradio-container .dark {
57
- color-scheme: dark;
58
  }
59
 
60
- .block.block.block,
61
- [id="checkbox-panel"],
62
- [id="search-panel"],
63
- [class*="block"] [class*="checkbox-panel"],
64
- [class*="block"] [class*="search-panel"] {
65
- background-color: #27272A !important;
66
  }
67
 
68
- /* Force all child elements to be transparent */
69
- [id="checkbox-panel"] *,
70
- [id="search-panel"] *,
71
- .checkbox-panel *,
72
- .search-panel * {
73
  background-color: transparent !important;
74
  }
75
  """
@@ -375,64 +361,38 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard", theme=custom_theme)
375
  <script>
376
  // Function to fix background colors
377
  function fixBackgrounds() {
378
- // Fix checkbox panel
379
- var checkboxPanels = document.querySelectorAll('.checkbox-panel');
380
- for (var i = 0; i < checkboxPanels.length; i++) {
381
- checkboxPanels[i].style.backgroundColor = '#27272A';
382
 
383
- // Find ALL child elements and make their backgrounds transparent
384
- var children = checkboxPanels[i].querySelectorAll('*');
385
- for (var j = 0; j < children.length; j++) {
386
- children[j].style.backgroundColor = 'transparent';
387
- }
 
 
388
  }
389
 
390
- // Fix search panel
391
- var searchPanels = document.querySelectorAll('.search-panel');
392
- for (var i = 0; i < searchPanels.length; i++) {
393
- searchPanels[i].style.backgroundColor = '#27272A';
394
 
395
- // Find ALL child elements and make their backgrounds transparent
396
- var children = searchPanels[i].querySelectorAll('*');
397
- for (var j = 0; j < children.length; j++) {
398
- children[j].style.backgroundColor = 'transparent';
 
 
399
  }
400
  }
401
-
402
- // Also try to find parent blocks and set their background
403
- var blocks = document.querySelectorAll('.block');
404
- blocks.forEach(function(block) {
405
- if (block.querySelector('.checkbox-panel') || block.classList.contains('checkbox-panel')) {
406
- block.style.backgroundColor = '#27272A';
407
-
408
- // Make all direct children transparent
409
- var children = block.children;
410
- for (var j = 0; j < children.length; j++) {
411
- if (!children[j].classList.contains('checkbox-panel')) {
412
- children[j].style.backgroundColor = 'transparent';
413
- }
414
- }
415
- }
416
- if (block.querySelector('.search-panel') || block.classList.contains('search-panel')) {
417
- block.style.backgroundColor = '#27272A';
418
-
419
- // Make all direct children transparent
420
- var children = block.children;
421
- for (var j = 0; j < children.length; j++) {
422
- if (!children[j].classList.contains('search-panel')) {
423
- children[j].style.backgroundColor = 'transparent';
424
- }
425
- }
426
- }
427
- });
428
  }
429
 
430
- // Run on page load and every second for 5 seconds to catch any delayed rendering
431
  setTimeout(fixBackgrounds, 500);
432
  setTimeout(fixBackgrounds, 1000);
433
  setTimeout(fixBackgrounds, 2000);
434
- setTimeout(fixBackgrounds, 3000);
435
- setTimeout(fixBackgrounds, 4000);
436
  </script>
437
  """)
438
 
@@ -449,7 +409,7 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard", theme=custom_theme)
449
  ''')
450
 
451
  # Add a direct HTML wrapper with inline style for the checkboxes
452
- gr.HTML('<div style="background-color: #27272A; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
453
 
454
  with gr.Row(elem_classes="checkbox-panel", elem_id="checkbox-panel"):
455
  cb_mwoz = gr.Checkbox(label="mwoz", value=True)
@@ -459,7 +419,7 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard", theme=custom_theme)
459
  gr.HTML('</div>')
460
 
461
  # Add a direct HTML wrapper with inline style for the search
462
- gr.HTML('<div style="background-color: #27272A; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
463
 
464
  with gr.Row(elem_classes="search-panel", elem_id="search-panel"):
465
  search_input = gr.Textbox(
 
35
  neutral_hue=colors.gray,
36
  text_size=gr.themes.sizes.text_lg
37
  )
38
+ # Don't set any global background colors
 
39
  self.block_border_width = "0px"
40
  self.block_shadow = "none"
 
 
41
 
42
+ # Add additional CSS for the new styles, being more specific
43
  custom_css += """
44
+ /* Only override specific panels by ID */
45
+ #checkbox-panel,
46
+ #search-panel {
47
+ background-color: #27272A !important;
 
 
 
 
 
 
 
48
  }
49
 
50
+ /* Only affect immediate children of these specific panels */
51
+ #checkbox-panel > *,
52
+ #search-panel > * {
53
+ background-color: transparent !important;
 
 
54
  }
55
 
56
+ /* Target checkbox inputs specifically */
57
+ #checkbox-panel input[type="checkbox"],
58
+ #search-panel input[type="text"] {
 
 
59
  background-color: transparent !important;
60
  }
61
  """
 
361
  <script>
362
  // Function to fix background colors
363
  function fixBackgrounds() {
364
+ // Only fix specific panels by ID
365
+ var checkboxPanel = document.getElementById('checkbox-panel');
366
+ if (checkboxPanel) {
367
+ checkboxPanel.style.backgroundColor = '#27272A';
368
 
369
+ // Only make checkboxes and their direct containers transparent
370
+ var checkboxes = checkboxPanel.querySelectorAll('input[type="checkbox"]');
371
+ checkboxes.forEach(function(checkbox) {
372
+ var parent = checkbox.parentElement;
373
+ if (parent) parent.style.backgroundColor = 'transparent';
374
+ checkbox.style.backgroundColor = 'transparent';
375
+ });
376
  }
377
 
378
+ var searchPanel = document.getElementById('search-panel');
379
+ if (searchPanel) {
380
+ searchPanel.style.backgroundColor = '#27272A';
 
381
 
382
+ // Only make search input and its direct container transparent
383
+ var searchInput = searchPanel.querySelector('input[type="text"]');
384
+ if (searchInput) {
385
+ var parent = searchInput.parentElement;
386
+ if (parent) parent.style.backgroundColor = 'transparent';
387
+ searchInput.style.backgroundColor = 'transparent';
388
  }
389
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  }
391
 
392
+ // Run on page load and every second for 3 seconds to catch any delayed rendering
393
  setTimeout(fixBackgrounds, 500);
394
  setTimeout(fixBackgrounds, 1000);
395
  setTimeout(fixBackgrounds, 2000);
 
 
396
  </script>
397
  """)
398
 
 
409
  ''')
410
 
411
  # Add a direct HTML wrapper with inline style for the checkboxes
412
+ gr.HTML('<div id="checkbox-wrapper" style="background-color: #27272A; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
413
 
414
  with gr.Row(elem_classes="checkbox-panel", elem_id="checkbox-panel"):
415
  cb_mwoz = gr.Checkbox(label="mwoz", value=True)
 
419
  gr.HTML('</div>')
420
 
421
  # Add a direct HTML wrapper with inline style for the search
422
+ gr.HTML('<div id="search-wrapper" style="background-color: #27272A; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
423
 
424
  with gr.Row(elem_classes="search-panel", elem_id="search-panel"):
425
  search_input = gr.Textbox(
styles.css CHANGED
@@ -190,135 +190,61 @@ input[type="text"]:focus {
190
  Checkbox Panel and Search Panel - High Specificity Rules
191
  ------------------------------------------------------------------ */
192
 
193
- /* Global resets for all panel elements */
194
- .checkbox-panel *,
195
- .search-panel * {
196
- background-color: transparent !important;
197
  }
198
 
199
- /* Target all possible Gradio wrappers for checkbox-panel with maximum specificity */
200
- body div.gradio-container div[class*="block"] div.checkbox-panel,
201
- body div.gradio-container [data-testid*="block"] div.checkbox-panel,
202
- body div.gradio-container [class*="row"] div.checkbox-panel,
203
- div[class*="gradio-container"] div.checkbox-panel,
204
- div.gradio-container [class*="row"] div.checkbox-panel,
205
  div.checkbox-panel,
206
- .checkbox-panel,
207
- #checkbox-panel {
 
208
  background-color: #27272A !important;
209
  padding: 12px !important;
210
  border-radius: 6px !important;
211
  margin-bottom: 1rem !important;
212
  }
213
 
214
- /* Target all possible Gradio wrappers for search-panel with maximum specificity */
215
- body div.gradio-container div[class*="block"] div.search-panel,
216
- body div.gradio-container [data-testid*="block"] div.search-panel,
217
- body div.gradio-container [class*="row"] div.search-panel,
218
- div[class*="gradio-container"] div.search-panel,
219
- div.gradio-container [class*="row"] div.search-panel,
220
  div.search-panel,
221
- .search-panel,
222
- #search-panel {
 
223
  background-color: #27272A !important;
224
  padding: 12px !important;
225
  border-radius: 6px !important;
226
  margin-bottom: 1rem !important;
227
  }
228
 
229
- /* Target gradio blocks that contain our panels */
230
- div[class*="block"] div.checkbox-panel,
231
- div.checkbox-panel[class*="block"],
232
- div[class*="block"].checkbox-panel,
233
- div[class*="block"] div.search-panel,
234
- div.search-panel[class*="block"],
235
- div[class*="block"].search-panel {
236
- background-color: #27272A !important;
237
- }
238
-
239
- /* Target the gradio block wrapper directly */
240
- div[class*="block"][id*="checkbox-panel"],
241
- div[class*="block"][id*="search-panel"] {
242
- background-color: green !important;
243
  }
244
 
245
- /* Target any div inside these panels to ensure children are transparent */
246
- .checkbox-panel div,
247
- .search-panel div {
248
  background-color: transparent !important;
249
  }
250
 
251
- /* Force all internal container elements to be transparent */
252
- .checkbox-panel [class*="container"],
253
- .search-panel [class*="container"],
254
- .checkbox-panel [class*="wrap"],
255
- .search-panel [class*="wrap"],
256
- .checkbox-panel [class*="form"],
257
- .search-panel [class*="form"] {
258
- background-color: transparent !important;
259
  }
260
 
261
- /* Additional style overrides for specific Gradio elements */
262
  .checkbox-panel .form,
263
- .checkbox-panel .form div,
264
  .checkbox-panel .block,
265
- .checkbox-panel .block div,
266
  .checkbox-panel .container,
267
- .checkbox-panel .container div,
268
  .search-panel .form,
269
- .search-panel .form div,
270
  .search-panel .block,
271
- .search-panel .block div,
272
  .search-panel .container,
273
- .search-panel .container div {
274
- background-color: transparent !important;
275
- }
276
-
277
- /* ------------------------------------------------------------------
278
- Override any Gradio-specific styles that might be interfering
279
- ------------------------------------------------------------------ */
280
- .gradio-container [class*="block"] {
281
- background-color: inherit;
282
- }
283
-
284
- /* Force all checkbox-panel descendants to have white text */
285
- .checkbox-panel,
286
- .checkbox-panel *,
287
- .checkbox-panel label,
288
- .checkbox-panel input,
289
- .checkbox-panel .label-wrap,
290
- .checkbox-panel .label-wrap span {
291
- color: #FFFFFF !important;
292
- }
293
-
294
- /* Force all search-panel descendants to have white text */
295
- .search-panel,
296
- .search-panel *,
297
- .search-panel label,
298
- .search-panel input,
299
- .search-panel .label-wrap,
300
- .search-panel .label-wrap span {
301
- color: #FFFFFF !important;
302
- }
303
-
304
- /* Make the form elements inside transparent */
305
- .search-panel input[type="text"],
306
- .search-panel .gr-form-group,
307
- .search-panel .block,
308
- .checkbox-panel .checkbox-container,
309
- .checkbox-panel .block {
310
- background-color: transparent !important;
311
- }
312
-
313
- /* Make the textbox border white */
314
  .search-panel input[type="text"] {
315
- border: 1px solid #FFFFFF !important;
316
  }
317
 
318
- /* Lighten the placeholder text */
319
- .search-panel input[type="text"]::placeholder {
320
- color: rgba(255,255,255,0.7) !important;
321
- }
322
 
323
  /* Root level variable override */
324
  :root {
 
190
  Checkbox Panel and Search Panel - High Specificity Rules
191
  ------------------------------------------------------------------ */
192
 
193
+ /* Reset the global styles to ensure we're only affecting what we want */
194
+ html body .gradio-container {
195
+ /* Default background stays as is */
 
196
  }
197
 
198
+ /* Only target the specific checkbox and search panels */
199
+ #checkbox-panel,
 
 
 
 
200
  div.checkbox-panel,
201
+ div[id="checkbox-panel"],
202
+ .gradio-container div[id="checkbox-panel"],
203
+ .gradio-container .checkbox-panel {
204
  background-color: #27272A !important;
205
  padding: 12px !important;
206
  border-radius: 6px !important;
207
  margin-bottom: 1rem !important;
208
  }
209
 
210
+ #search-panel,
 
 
 
 
 
211
  div.search-panel,
212
+ div[id="search-panel"],
213
+ .gradio-container div[id="search-panel"],
214
+ .gradio-container .search-panel {
215
  background-color: #27272A !important;
216
  padding: 12px !important;
217
  border-radius: 6px !important;
218
  margin-bottom: 1rem !important;
219
  }
220
 
221
+ /* Make inner components transparent to let background show through */
222
+ #checkbox-panel *, .checkbox-panel * {
223
+ background-color: transparent !important;
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
 
226
+ #search-panel *, .search-panel * {
 
 
227
  background-color: transparent !important;
228
  }
229
 
230
+ /* Override other styles that might be affecting the color */
231
+ div[class*="block"] {
232
+ background-color: initial; /* Reset to default */
 
 
 
 
 
233
  }
234
 
235
+ /* Only make transparent what we need to be transparent */
236
  .checkbox-panel .form,
 
237
  .checkbox-panel .block,
 
238
  .checkbox-panel .container,
239
+ .checkbox-panel input[type="checkbox"],
240
  .search-panel .form,
 
241
  .search-panel .block,
 
242
  .search-panel .container,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  .search-panel input[type="text"] {
244
+ background-color: transparent !important;
245
  }
246
 
247
+ /* Remove overly broad selectors affecting too many elements */
 
 
 
248
 
249
  /* Root level variable override */
250
  :root {