Molbap HF Staff commited on
Commit
dd22158
·
verified ·
1 Parent(s): b327574

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -39
app.py CHANGED
@@ -327,16 +327,19 @@ INSERTS = {
327
  # ---------------------------
328
 
329
  CSS = """
330
- :root {
331
- color-scheme: dark;
332
- --body-background-fill: #ffffff;
333
- --body-text-color: #1f2937; /* darker gray for better contrast */
334
- --heading-text-color: #111827; /* near black for headings */
335
- --link-text-color: #2563eb; /* stronger blue */
336
- --border-color: #d1d5db; /* slightly darker border */
 
 
 
337
  }
338
 
339
- /* Load Inter; if Google Fonts is blocked, the @font-face fallback is used */
340
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
341
  @font-face {
342
  font-family: 'Inter var';
@@ -345,63 +348,51 @@ CSS = """
345
  font-display: swap;
346
  src: url('https://rsms.me/inter/font-files/Inter.var.woff2?v=3.19') format('woff2');
347
  }
348
-
349
  html, body, .gradio-container { background: #fff !important; }
350
- .gradio-container { font-family: 'Inter', 'Inter var', system-ui, -apple-system, Segoe UI, Roboto, sans-serif !important; }
351
 
352
- /* Layout (don’t clamp all nested divs) */
353
  #layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; }
354
  #toc { position: sticky; top: 1rem; height: calc(100vh - 2rem); overflow: auto; padding-right: 1rem; }
355
- #toc a { display: block; padding: .5rem 0; color: #4b5563; font-size: .875rem; text-decoration: none; font-weight: 500; }
356
  #toc a:hover { color: var(--link-text-color); }
357
 
358
- /* Scope ALL article typography to .article to beat Gradio’s prose opacity */
359
- .article,
360
- .article :where(p, li, code, pre, blockquote, h1, h2, h3, h4, h5, h6, a, strong, em) {
361
- color: var(--body-text-color) !important;
362
  opacity: 1 !important;
363
- -webkit-font-smoothing: antialiased;
364
- -moz-osx-font-smoothing: grayscale;
365
  }
366
 
367
- /* Article width and centering */
368
  .article { max-width: 72ch; margin: 0 auto; }
 
 
 
 
 
369
 
370
- /* Headings */
371
- .article h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.6rem; color: var(--heading-text-color) !important; margin: 2rem 0 1.25rem; }
372
- .article h2 { font-weight: 600; font-size: 1.875rem; line-height: 2.25rem; color: var(--heading-text-color) !important; margin: 2rem 0 1rem; }
373
- .article h3 { font-weight: 600; font-size: 1.5rem; line-height: 2rem; color: var(--heading-text-color) !important; margin: 1.5rem 0 .75rem; }
374
-
375
- /* Body text and lists */
376
- .article p, .article li { font-size: 1.02rem; line-height: 1.8rem; }
377
- .article ul, .article ol { padding-left: 1.5rem; margin: 1rem 0; }
378
  .article a { color: var(--link-text-color) !important; text-decoration: underline; }
379
  .article a:hover { text-decoration: none; }
380
 
381
- /* Code blocks and inline code */
382
  .article pre {
383
  background: #f8fafc; border: 1px solid var(--border-color); border-radius: 8px;
384
  padding: 1rem; margin: 1.25rem 0; overflow-x: auto;
385
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
386
- font-size: .92rem; line-height: 1.6rem;
387
- color: #1f2937 !important;
388
  }
389
  .article code {
390
- background: #e2e8f0; color: #1e293b !important; padding: .15rem .35rem; border-radius: .25rem;
391
- font-weight: 500;
392
  }
393
 
394
- /* Blockquotes */
395
- .article blockquote { border-left: 4px solid var(--link-text-color); padding-left: 1rem; margin: 1.25rem 0; color: #475569 !important; font-style: italic; }
396
-
397
- /* Images inside article */
398
  .article img { display: block; max-width: 100%; height: auto; margin: 1.25rem auto; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
399
-
400
- /* Horizontal rule and anchor offset */
401
  hr { border: 0; border-top: 1px solid var(--border-color); margin: 2rem 0; }
402
  .section { scroll-margin-top: 80px; }
403
 
404
- /* Keep widgets full width; don’t inherit article max-width */
405
  .gr-form, .gr-panel, .gr-block { max-width: none; }
406
 
407
  """
 
327
  # ---------------------------
328
 
329
  CSS = """
330
+ /* Force light palette + high contrast */
331
+ :root,
332
+ .gradio-container {
333
+ color-scheme: light !important;
334
+ --body-background-fill: #ffffff !important;
335
+ --body-text-color: #0b0f19 !important; /* main text */
336
+ --body-text-color-subdued: #0b0f19 !important; /* kill the grey tint */
337
+ --heading-text-color: #0b0f19 !important;
338
+ --link-text-color: #1d4ed8 !important;
339
+ --border-color: #e5e7eb !important;
340
  }
341
 
342
+ /* Font (slightly heavier by default to avoid “spindly” Inter on Linux) */
343
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
344
  @font-face {
345
  font-family: 'Inter var';
 
348
  font-display: swap;
349
  src: url('https://rsms.me/inter/font-files/Inter.var.woff2?v=3.19') format('woff2');
350
  }
 
351
  html, body, .gradio-container { background: #fff !important; }
352
+ .gradio-container { font-family: 'Inter','Inter var',system-ui,-apple-system,Segoe UI,Roboto,sans-serif !important; }
353
 
354
+ /* Layout */
355
  #layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; }
356
  #toc { position: sticky; top: 1rem; height: calc(100vh - 2rem); overflow: auto; padding-right: 1rem; }
357
+ #toc a { display: block; padding: .5rem 0; color: #334155; font-size: .9rem; text-decoration: none; font-weight: 500; }
358
  #toc a:hover { color: var(--link-text-color); }
359
 
360
+ /* HARD override: make sure no parent opacity dulls the article */
361
+ .gradio-container .gr-html,
362
+ .gradio-container .gr-html * {
 
363
  opacity: 1 !important;
364
+ color: var(--body-text-color) !important;
 
365
  }
366
 
367
+ /* Scope article typography */
368
  .article { max-width: 72ch; margin: 0 auto; }
369
+ .article p, .article li { font-size: 1.04rem; line-height: 1.85rem; font-weight: 500; }
370
+ .article h1, .article h2, .article h3, .article h4 { color: var(--heading-text-color) !important; }
371
+ .article h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.6rem; margin: 2rem 0 1.25rem; }
372
+ .article h2 { font-weight: 650; font-size: 1.85rem; line-height: 2.25rem; margin: 2rem 0 1rem; }
373
+ .article h3 { font-weight: 600; font-size: 1.5rem; line-height: 2rem; margin: 1.5rem 0 .75rem; }
374
 
 
 
 
 
 
 
 
 
375
  .article a { color: var(--link-text-color) !important; text-decoration: underline; }
376
  .article a:hover { text-decoration: none; }
377
 
378
+ /* Code */
379
  .article pre {
380
  background: #f8fafc; border: 1px solid var(--border-color); border-radius: 8px;
381
  padding: 1rem; margin: 1.25rem 0; overflow-x: auto;
382
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
383
+ font-size: .95rem; line-height: 1.6rem; color: #0b0f19 !important;
 
384
  }
385
  .article code {
386
+ background: #e2e8f0; color: #0b0f19 !important; padding: .15rem .35rem; border-radius: .25rem; font-weight: 600;
 
387
  }
388
 
389
+ /* Blockquotes, images, rules */
390
+ .article blockquote { border-left: 4px solid var(--link-text-color); padding-left: 1rem; margin: 1.25rem 0; color: #334155 !important; font-style: italic; }
 
 
391
  .article img { display: block; max-width: 100%; height: auto; margin: 1.25rem auto; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
 
 
392
  hr { border: 0; border-top: 1px solid var(--border-color); margin: 2rem 0; }
393
  .section { scroll-margin-top: 80px; }
394
 
395
+ /* Keep widgets full width */
396
  .gr-form, .gr-panel, .gr-block { max-width: none; }
397
 
398
  """