blackboxanalytics commited on
Commit
333cd03
Β·
verified Β·
1 Parent(s): 28da886

Force dark mode + brighten muted text for readability

Browse files
Files changed (1) hide show
  1. app.py +28 -16
app.py CHANGED
@@ -467,8 +467,8 @@ footer { display: none !important; }
467
  background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
468
  background-clip: text; animation: shimmer 6s linear infinite; }
469
  @keyframes shimmer { to { background-position: 200% center; } }
470
- .hdr-sub { color: #50508a; font-size: .87rem; margin: 0; }
471
- .hdr-sub strong { color: #8585bb; }
472
 
473
  /* ── mute toggle ── */
474
  .rl-mute { position:absolute; top:.4rem; right:.2rem; background:#0f0f28; border:1px solid #242456;
@@ -481,18 +481,18 @@ footer { display: none !important; }
481
  .stat-row { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
482
  .stat-item { display:flex; flex-direction:column; align-items:center; }
483
  .snum { font-size:1.25rem; font-weight:800; color:#a78bfa; line-height:1.05; transition:color .3s; }
484
- .slbl { font-size:.58rem; color:#404070; text-transform:uppercase; letter-spacing:.07em; }
485
  .sdot { color:#1e1e48; }
486
  .pbar-wrap { flex:1; min-width:60px; height:5px; background:#1e1e48; border-radius:3px; overflow:hidden; }
487
  .pbar-fill { height:100%; background:linear-gradient(90deg,#7c3aed,#60a5fa,#f472b6); background-size:200% auto; transition:width .5s ease; animation:shimmer 3s linear infinite; }
488
- .pbar-lbl { color:#50508a; font-size:.74rem; font-weight:600; min-width:2.4rem; text-align:right; }
489
  .cat-counts { display:flex; gap:.32rem; flex-wrap:wrap; margin-top:.55rem; padding-top:.55rem; border-top:1px solid #16163a; }
490
- .cat-count { background:#0a0a20; border:1px solid #1e1e48; border-radius:7px; padding:.1rem .42rem; font-size:.72rem; color:#6868a8; transition:transform .1s, border-color .15s; }
491
  .cat-count:hover { transform:translateY(-1px); border-color:#34346e; }
492
 
493
  /* ── why-884 tooltip ── */
494
  .why-line { margin-top:.5rem; padding-top:.5rem; border-top:1px solid #16163a; }
495
- .why-chip { position:relative; display:inline-block; font-size:.74rem; color:#6a6aa8;
496
  background:#0a0a20; border:1px solid #20204a; border-radius:8px; padding:.12rem .5rem; cursor:help; outline:none; }
497
  .why-chip:hover, .why-chip:focus { border-color:#7c3aed; color:#a78bfa; }
498
  .why-pop { position:absolute; left:0; bottom:130%; width:300px; max-width:80vw; z-index:20;
@@ -521,7 +521,7 @@ footer { display: none !important; }
521
  #back-btn:disabled, #back-btn button:disabled, #back-btn[disabled] { opacity:.38!important; cursor:not-allowed!important; box-shadow:none!important; transform:none!important; }
522
  #back-btn.spinning, #back-btn.spinning button { animation: glow-fast .4s ease-in-out infinite; border-color:#7c3aed!important; }
523
 
524
- #cat-dd label span { color:#50508a!important; font-size:.78rem!important; }
525
  #cat-dd input, #cat-dd .wrap { background:#0f0f28!important; border-color:#1e1e48!important; color:#c0c0e8!important; }
526
 
527
  /* ── slot reel (shown while waiting for the draw) ── */
@@ -563,19 +563,19 @@ footer { display: none !important; }
563
  .sdk-pill { background:#0a1420; border:1px solid #1a3050; border-radius:10px; padding:.2rem .6rem; font-size:.7rem; color:#6aa8e0; text-transform:uppercase; letter-spacing:.04em; }
564
  .likes-pill { margin-left:auto; color:#f472b6; font-weight:700; font-size:.86rem; }
565
  .card-h { font-size:1.5rem; font-weight:900; color:#e6e6ff; margin:0 0 .15rem; line-height:1.18; position:relative; z-index:2; }
566
- .card-by { color:#45457a; font-size:.86rem; margin:0 0 .8rem; position:relative; z-index:2; }
567
- .card-by strong { color:#7070b0; }
568
- .card-desc { color:#8888c0; font-size:.95rem; line-height:1.6; margin:0 0 1rem; position:relative; z-index:2; }
569
- .card-desc .nodesc { color:#454575; }
570
  .card-chips { display:flex; flex-wrap:wrap; gap:.3rem; margin-bottom:1.1rem; position:relative; z-index:2; }
571
- .tag-chip { background:#080818; border:1px solid #1c1c3c; border-radius:6px; padding:.13rem .48rem; font-size:.68rem; color:#5a5a92; }
572
  .card-foot { display:flex; align-items:center; gap:.8rem; }
573
  .open-btn { display:inline-block; background:linear-gradient(135deg,#7c3aed,#2563eb); color:#fff!important; text-decoration:none!important;
574
  border-radius:10px; padding:.55rem 1.3rem; font-weight:700; font-size:.92rem; box-shadow:0 2px 12px rgba(124,58,237,.35); transition:opacity .18s,transform .1s; }
575
  .open-btn:hover { opacity:.9; transform:translateY(-1px); }
576
- .draw-note { color:#3a3a68; font-size:.74rem; }
577
 
578
- .ph-wrap { text-align:center; padding:2.6rem 1rem; color:#404070; }
579
  .ph-dice { font-size:3.1rem; margin-bottom:.6rem; animation:float 3s ease-in-out infinite; }
580
  @keyframes float { 0%,100%{transform:translateY(0) rotate(-4deg)} 50%{transform:translateY(-10px) rotate(4deg)} }
581
  .ph-txt { font-size:1rem; } .ph-txt strong { color:#a78bfa; }
@@ -589,9 +589,9 @@ footer { display: none !important; }
589
  .br-em { font-size:1rem; }
590
  .br-name { color:#c8c8f0; font-weight:600; font-size:.9rem; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
591
  .seen-dot { color:#4ade80; font-size:.78rem; margin-left:.4rem; }
592
- .br-author { color:#4a4a80; font-size:.78rem; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
593
  .br-likes { color:#f472b6; font-size:.78rem; font-weight:600; }
594
- .browse-more, .browse-empty { color:#45457a; font-size:.82rem; text-align:center; padding:.6rem; }
595
  """
596
 
597
  # ── Client-side JS (synthesized sound + confetti + slot reel) ─────────────────
@@ -602,6 +602,18 @@ footer { display: none !important; }
602
  # throttled/short envelopes keep it tasteful rather than grating.
603
 
604
  HEAD_HTML = r"""<script>
 
 
 
 
 
 
 
 
 
 
 
 
605
  (function () {
606
  if (window.RL) return;
607
  const RL = window.RL = { muted: false };
 
467
  background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
468
  background-clip: text; animation: shimmer 6s linear infinite; }
469
  @keyframes shimmer { to { background-position: 200% center; } }
470
+ .hdr-sub { color: #9292c6; font-size: .87rem; margin: 0; }
471
+ .hdr-sub strong { color: #b8b8e0; }
472
 
473
  /* ── mute toggle ── */
474
  .rl-mute { position:absolute; top:.4rem; right:.2rem; background:#0f0f28; border:1px solid #242456;
 
481
  .stat-row { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
482
  .stat-item { display:flex; flex-direction:column; align-items:center; }
483
  .snum { font-size:1.25rem; font-weight:800; color:#a78bfa; line-height:1.05; transition:color .3s; }
484
+ .slbl { font-size:.58rem; color:#9090c4; text-transform:uppercase; letter-spacing:.07em; }
485
  .sdot { color:#1e1e48; }
486
  .pbar-wrap { flex:1; min-width:60px; height:5px; background:#1e1e48; border-radius:3px; overflow:hidden; }
487
  .pbar-fill { height:100%; background:linear-gradient(90deg,#7c3aed,#60a5fa,#f472b6); background-size:200% auto; transition:width .5s ease; animation:shimmer 3s linear infinite; }
488
+ .pbar-lbl { color:#9292c6; font-size:.74rem; font-weight:600; min-width:2.4rem; text-align:right; }
489
  .cat-counts { display:flex; gap:.32rem; flex-wrap:wrap; margin-top:.55rem; padding-top:.55rem; border-top:1px solid #16163a; }
490
+ .cat-count { background:#0a0a20; border:1px solid #1e1e48; border-radius:7px; padding:.1rem .42rem; font-size:.72rem; color:#9a9acc; transition:transform .1s, border-color .15s; }
491
  .cat-count:hover { transform:translateY(-1px); border-color:#34346e; }
492
 
493
  /* ── why-884 tooltip ── */
494
  .why-line { margin-top:.5rem; padding-top:.5rem; border-top:1px solid #16163a; }
495
+ .why-chip { position:relative; display:inline-block; font-size:.74rem; color:#9a9acc;
496
  background:#0a0a20; border:1px solid #20204a; border-radius:8px; padding:.12rem .5rem; cursor:help; outline:none; }
497
  .why-chip:hover, .why-chip:focus { border-color:#7c3aed; color:#a78bfa; }
498
  .why-pop { position:absolute; left:0; bottom:130%; width:300px; max-width:80vw; z-index:20;
 
521
  #back-btn:disabled, #back-btn button:disabled, #back-btn[disabled] { opacity:.38!important; cursor:not-allowed!important; box-shadow:none!important; transform:none!important; }
522
  #back-btn.spinning, #back-btn.spinning button { animation: glow-fast .4s ease-in-out infinite; border-color:#7c3aed!important; }
523
 
524
+ #cat-dd label span { color:#9292c6!important; font-size:.78rem!important; }
525
  #cat-dd input, #cat-dd .wrap { background:#0f0f28!important; border-color:#1e1e48!important; color:#c0c0e8!important; }
526
 
527
  /* ── slot reel (shown while waiting for the draw) ── */
 
563
  .sdk-pill { background:#0a1420; border:1px solid #1a3050; border-radius:10px; padding:.2rem .6rem; font-size:.7rem; color:#6aa8e0; text-transform:uppercase; letter-spacing:.04em; }
564
  .likes-pill { margin-left:auto; color:#f472b6; font-weight:700; font-size:.86rem; }
565
  .card-h { font-size:1.5rem; font-weight:900; color:#e6e6ff; margin:0 0 .15rem; line-height:1.18; position:relative; z-index:2; }
566
+ .card-by { color:#9090c4; font-size:.86rem; margin:0 0 .8rem; position:relative; z-index:2; }
567
+ .card-by strong { color:#b8b8e0; }
568
+ .card-desc { color:#9c9cd2; font-size:.95rem; line-height:1.6; margin:0 0 1rem; position:relative; z-index:2; }
569
+ .card-desc .nodesc { color:#8c8cc2; }
570
  .card-chips { display:flex; flex-wrap:wrap; gap:.3rem; margin-bottom:1.1rem; position:relative; z-index:2; }
571
+ .tag-chip { background:#080818; border:1px solid #1c1c3c; border-radius:6px; padding:.13rem .48rem; font-size:.68rem; color:#9a9acc; }
572
  .card-foot { display:flex; align-items:center; gap:.8rem; }
573
  .open-btn { display:inline-block; background:linear-gradient(135deg,#7c3aed,#2563eb); color:#fff!important; text-decoration:none!important;
574
  border-radius:10px; padding:.55rem 1.3rem; font-weight:700; font-size:.92rem; box-shadow:0 2px 12px rgba(124,58,237,.35); transition:opacity .18s,transform .1s; }
575
  .open-btn:hover { opacity:.9; transform:translateY(-1px); }
576
+ .draw-note { color:#8484b8; font-size:.74rem; }
577
 
578
+ .ph-wrap { text-align:center; padding:2.6rem 1rem; color:#9090c4; }
579
  .ph-dice { font-size:3.1rem; margin-bottom:.6rem; animation:float 3s ease-in-out infinite; }
580
  @keyframes float { 0%,100%{transform:translateY(0) rotate(-4deg)} 50%{transform:translateY(-10px) rotate(4deg)} }
581
  .ph-txt { font-size:1rem; } .ph-txt strong { color:#a78bfa; }
 
589
  .br-em { font-size:1rem; }
590
  .br-name { color:#c8c8f0; font-weight:600; font-size:.9rem; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
591
  .seen-dot { color:#4ade80; font-size:.78rem; margin-left:.4rem; }
592
+ .br-author { color:#9090c4; font-size:.78rem; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
593
  .br-likes { color:#f472b6; font-size:.78rem; font-weight:600; }
594
+ .browse-more, .browse-empty { color:#9090c4; font-size:.82rem; text-align:center; padding:.6rem; }
595
  """
596
 
597
  # ── Client-side JS (synthesized sound + confetti + slot reel) ─────────────────
 
602
  # throttled/short envelopes keep it tasteful rather than grating.
603
 
604
  HEAD_HTML = r"""<script>
605
+ // Force dark mode for ALL components regardless of the visitor's system theme.
606
+ // The custom CSS only darkens our own elements; Gradio's native chrome (dropdown,
607
+ // accordion, labels, option popups) otherwise keeps the light theme's dark text,
608
+ // which is unreadable on the dark background. Adding `dark` to <html> makes Gradio
609
+ // apply its dark palette everywhere; a MutationObserver re-asserts it if Gradio
610
+ // flips it back for a light-system viewer.
611
+ (function forceDark() {
612
+ const el = document.documentElement;
613
+ const ensure = () => { if (!el.classList.contains('dark')) el.classList.add('dark'); };
614
+ ensure();
615
+ try { new MutationObserver(ensure).observe(el, { attributes: true, attributeFilter: ['class'] }); } catch (e) {}
616
+ })();
617
  (function () {
618
  if (window.RL) return;
619
  const RL = window.RL = { muted: false };