ZhouChuYue commited on
Commit
f362e3f
·
1 Parent(s): 1d93c0f

fix: improve dark mode contrast and text visibility

Browse files
Files changed (1) hide show
  1. app.py +51 -66
app.py CHANGED
@@ -176,15 +176,13 @@ custom_css = """
176
 
177
  :root {
178
  --primary-color: #6366f1;
179
- --secondary-color: #ec4899;
180
- --background-dark: #0f172a;
181
- --panel-bg: rgba(30, 41, 59, 0.7);
182
  --text-light: #f8fafc;
183
- --text-gray: #94a3b8;
 
184
  }
185
 
186
  body {
187
- background-color: var(--background-dark);
188
  color: var(--text-light);
189
  }
190
 
@@ -194,6 +192,11 @@ body {
194
  max-width: 1200px !important;
195
  }
196
 
 
 
 
 
 
197
  /* Title & Header */
198
  .main-title {
199
  font-family: 'Inter', sans-serif !important;
@@ -204,7 +207,8 @@ body {
204
  -webkit-text-fill-color: transparent !important;
205
  text-align: center !important;
206
  margin-bottom: 0.5rem !important;
207
- letter-spacing: -0.02em !important;
 
208
  }
209
 
210
  .subtitle {
@@ -215,53 +219,40 @@ body {
215
  font-weight: 300 !important;
216
  }
217
 
218
- /* Tabs */
219
- .tabs {
220
- border: none !important;
221
- background: transparent !important;
222
- margin-bottom: 2rem !important;
223
- }
224
-
225
- .tab-nav {
226
- border-bottom: 1px solid rgba(148, 163, 184, 0.2) !important;
227
- justify-content: center !important;
228
- }
229
-
230
- .tab-nav button {
231
- font-weight: 600 !important;
232
- font-size: 1rem !important;
233
- color: var(--text-gray) !important;
234
- transition: all 0.3s ease !important;
235
- }
236
-
237
- .tab-nav button.selected {
238
- color: #818cf8 !important;
239
- border-bottom: 2px solid #818cf8 !important;
240
- }
241
-
242
- /* Panels & Cards */
243
  .glass-panel {
244
  background: var(--panel-bg) !important;
245
  backdrop-filter: blur(12px) !important;
246
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
247
  border-radius: 16px !important;
248
  padding: 24px !important;
249
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
250
  }
251
 
252
- /* Inputs */
253
- textarea, input {
 
254
  font-family: 'JetBrains Mono', monospace !important;
255
- background: rgba(15, 23, 42, 0.6) !important;
256
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
 
 
 
 
 
 
 
 
 
 
 
257
  color: var(--text-light) !important;
258
- border-radius: 8px !important;
259
- transition: border-color 0.2s !important;
260
  }
261
 
262
- textarea:focus, input:focus {
263
- border-color: var(--primary-color) !important;
264
- box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
 
265
  }
266
 
267
  /* Buttons */
@@ -270,43 +261,37 @@ textarea:focus, input:focus {
270
  border: none !important;
271
  color: white !important;
272
  font-weight: 600 !important;
273
- border-radius: 8px !important;
274
- transition: transform 0.2s, box-shadow 0.2s !important;
275
  }
276
 
277
- .gr-button-primary:hover {
278
- transform: translateY(-1px) !important;
279
- box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3) !important;
 
 
 
 
280
  }
281
 
282
- .gr-button-secondary {
283
- background: rgba(30, 41, 59, 0.8) !important;
284
- border: 1px solid rgba(148, 163, 184, 0.3) !important;
285
  color: var(--text-gray) !important;
286
- border-radius: 8px !important;
287
  }
288
-
289
- .gr-button-secondary:hover {
290
- background: rgba(51, 65, 85, 0.8) !important;
291
- color: var(--text-light) !important;
292
  }
293
 
294
- /* Labels */
295
- label span {
296
- color: #cbd5e1 !important;
297
- font-weight: 500 !important;
298
- font-size: 0.9rem !important;
299
- margin-bottom: 0.5rem !important;
300
  }
301
 
302
  /* Footer */
303
- .footer-text {
304
- text-align: center;
305
- margin-top: 4rem;
306
- padding: 2rem;
307
- color: var(--text-gray);
308
- font-size: 0.9rem;
309
- border-top: 1px solid rgba(148, 163, 184, 0.1);
310
  }
311
  """
312
 
 
176
 
177
  :root {
178
  --primary-color: #6366f1;
 
 
 
179
  --text-light: #f8fafc;
180
+ --text-gray: #cbd5e1;
181
+ --panel-bg: rgba(15, 23, 42, 0.6);
182
  }
183
 
184
  body {
185
+ background-color: #0f172a;
186
  color: var(--text-light);
187
  }
188
 
 
192
  max-width: 1200px !important;
193
  }
194
 
195
+ /* Force all text to be light by default to combat Gradio's light theme defaults */
196
+ .gradio-container * {
197
+ color: var(--text-light);
198
+ }
199
+
200
  /* Title & Header */
201
  .main-title {
202
  font-family: 'Inter', sans-serif !important;
 
207
  -webkit-text-fill-color: transparent !important;
208
  text-align: center !important;
209
  margin-bottom: 0.5rem !important;
210
+ /* Reset color for gradient text */
211
+ color: transparent !important;
212
  }
213
 
214
  .subtitle {
 
219
  font-weight: 300 !important;
220
  }
221
 
222
+ /* Panels */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  .glass-panel {
224
  background: var(--panel-bg) !important;
225
  backdrop-filter: blur(12px) !important;
226
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
227
  border-radius: 16px !important;
228
  padding: 24px !important;
229
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
230
  }
231
 
232
+ /* Inputs & Textareas */
233
+ /* Target specific Gradio input classes and generic elements */
234
+ .gr-input, textarea, input, .gr-box, .gr-check-radio, .gr-dropdown {
235
  font-family: 'JetBrains Mono', monospace !important;
236
+ background-color: rgba(30, 41, 59, 0.5) !important;
237
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
238
+ color: #ffffff !important;
239
+ }
240
+
241
+ /* Fix for dropdown options background */
242
+ ul.options, .gr-dropdown-options {
243
+ background-color: #1e293b !important;
244
+ color: #ffffff !important;
245
+ }
246
+
247
+ /* Markdown prose - Gradio uses typography plugin which sets dark colors */
248
+ .prose, .prose p, .prose h1, .prose h2, .prose h3, .prose strong, .prose li {
249
  color: var(--text-light) !important;
 
 
250
  }
251
 
252
+ /* Labels */
253
+ label span, .gr-form label span {
254
+ color: var(--text-gray) !important;
255
+ font-weight: 500 !important;
256
  }
257
 
258
  /* Buttons */
 
261
  border: none !important;
262
  color: white !important;
263
  font-weight: 600 !important;
 
 
264
  }
265
 
266
+ .gr-button-secondary {
267
+ background: rgba(255, 255, 255, 0.1) !important;
268
+ border: 1px solid rgba(255, 255, 255, 0.2) !important;
269
+ color: var(--text-light) !important;
270
+ }
271
+ .gr-button-secondary:hover {
272
+ background: rgba(255, 255, 255, 0.2) !important;
273
  }
274
 
275
+ /* Tabs */
276
+ .tabs button {
 
277
  color: var(--text-gray) !important;
 
278
  }
279
+ .tabs button.selected {
280
+ color: #818cf8 !important;
281
+ border-bottom-color: #818cf8 !important;
 
282
  }
283
 
284
+ /* Radio buttons */
285
+ .gr-radio-label {
286
+ color: var(--text-light) !important;
 
 
 
287
  }
288
 
289
  /* Footer */
290
+ .footer-text, .footer-text p {
291
+ color: var(--text-gray) !important;
292
+ }
293
+ .footer-text a {
294
+ color: #818cf8 !important;
 
 
295
  }
296
  """
297