Jasonkim8652 commited on
Commit
bfce576
·
verified ·
1 Parent(s): 8d9b6f4

fix: force light mode + dark mode CSS fallback for text visibility

Browse files
Files changed (1) hide show
  1. app.py +46 -0
app.py CHANGED
@@ -111,6 +111,51 @@ def load_data() -> dict:
111
  CUSTOM_CSS = """
112
  .gradio-container { max-width: 1200px !important; }
113
  .gr-padded { padding: 0 !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  """
115
 
116
 
@@ -839,6 +884,7 @@ def create_app() -> gr.Blocks:
839
  with gr.Blocks(
840
  theme=gr.themes.Soft(primary_hue="blue"),
841
  css=CUSTOM_CSS,
 
842
  ) as app:
843
 
844
  gr.HTML(build_header(data["last_updated"], len(entries)))
 
111
  CUSTOM_CSS = """
112
  .gradio-container { max-width: 1200px !important; }
113
  .gr-padded { padding: 0 !important; }
114
+
115
+ /* Force light appearance for all inline-styled HTML content */
116
+ .dark .gradio-container {
117
+ --body-background-fill: #f7fafc !important;
118
+ --block-background-fill: #ffffff !important;
119
+ --body-text-color: #1a202c !important;
120
+ --block-label-text-color: #1a202c !important;
121
+ --input-background-fill: #ffffff !important;
122
+ --border-color-primary: #e2e8f0 !important;
123
+ --color-accent-soft: rgba(49,130,206,0.15) !important;
124
+ --neutral-50: #f7fafc !important;
125
+ --neutral-100: #edf2f7 !important;
126
+ --neutral-200: #e2e8f0 !important;
127
+ --neutral-700: #4a5568 !important;
128
+ --neutral-800: #2d3748 !important;
129
+ color: #1a202c !important;
130
+ background: #f7fafc !important;
131
+ }
132
+ .dark .tabs { background: #ffffff !important; }
133
+ .dark .tab-nav button { color: #2d3748 !important; }
134
+ .dark .tab-nav button.selected {
135
+ color: #1a365d !important;
136
+ border-color: #3182ce !important;
137
+ }
138
+ .dark .block { background: #ffffff !important; }
139
+ .dark label, .dark .label-wrap { color: #2d3748 !important; }
140
+ .dark input, .dark textarea, .dark select {
141
+ background: #ffffff !important;
142
+ color: #1a202c !important;
143
+ border-color: #e2e8f0 !important;
144
+ }
145
+ .dark .accordion { background: #ffffff !important; }
146
+ .dark .accordion > .label-wrap { color: #2d3748 !important; }
147
+ """
148
+
149
+ # Force light mode on page load
150
+ FORCE_LIGHT_JS = """
151
+ () => {
152
+ document.querySelector('body').classList.remove('dark');
153
+ const obs = new MutationObserver(() => {
154
+ document.querySelector('body').classList.remove('dark');
155
+ });
156
+ obs.observe(document.body, {attributes: true, attributeFilter: ['class']});
157
+ setTimeout(() => obs.disconnect(), 5000);
158
+ }
159
  """
160
 
161
 
 
884
  with gr.Blocks(
885
  theme=gr.themes.Soft(primary_hue="blue"),
886
  css=CUSTOM_CSS,
887
+ js=FORCE_LIGHT_JS,
888
  ) as app:
889
 
890
  gr.HTML(build_header(data["last_updated"], len(entries)))