Vladyslav Humennyy commited on
Commit
732a3b9
·
1 Parent(s): c9eb033

Force light theme

Browse files
Files changed (2) hide show
  1. static/script.js +33 -0
  2. static/style.css +38 -0
static/script.js CHANGED
@@ -93,6 +93,39 @@
93
  }, delay);
94
  });
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  // Also set up immediately if DOM is ready
97
  if (document.readyState !== 'loading') {
98
  setupKeyboardShortcuts();
 
93
  }, delay);
94
  });
95
 
96
+ // Force light theme - disable dark mode switching
97
+ const forceTheme = () => {
98
+ // Remove any dark theme classes that might be added
99
+ document.documentElement.classList.remove('dark');
100
+ document.body.classList.remove('dark');
101
+
102
+ // Set light color scheme
103
+ document.documentElement.style.colorScheme = 'light';
104
+
105
+ // Override any theme preference that might be set
106
+ if (window.matchMedia) {
107
+ const darkModeQuery = window.matchMedia('(prefers-color-scheme: dark)');
108
+ // Override the matches property to always return false
109
+ Object.defineProperty(darkModeQuery, 'matches', {
110
+ value: false,
111
+ writable: false
112
+ });
113
+ }
114
+ };
115
+
116
+ // Apply theme override immediately and on any DOM changes
117
+ forceTheme();
118
+
119
+ // Watch for any changes and reapply theme override
120
+ const observer = new MutationObserver(() => {
121
+ forceTheme();
122
+ });
123
+
124
+ observer.observe(document.documentElement, {
125
+ attributes: true,
126
+ attributeFilter: ['class', 'data-theme', 'theme']
127
+ });
128
+
129
  // Also set up immediately if DOM is ready
130
  if (document.readyState !== 'loading') {
131
  setupKeyboardShortcuts();
static/style.css CHANGED
@@ -216,3 +216,41 @@
216
  padding: 0 !important;
217
  pointer-events: none !important;
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  padding: 0 !important;
217
  pointer-events: none !important;
218
  }
219
+
220
+ /* Force light theme - Disable dark mode switching */
221
+ @media (prefers-color-scheme: dark) {
222
+ .gradio-container {
223
+ background: radial-gradient(1200px 600px at 20% 0%, #f1f5f9 0%, #e2e8f0 45%, #cbd5e1 100%) !important;
224
+ color-scheme: light !important;
225
+ }
226
+
227
+ /* Ensure all elements use light theme colors */
228
+ .gradio-container * {
229
+ color-scheme: light !important;
230
+ }
231
+
232
+ /* Override any dark mode styles that might be applied */
233
+ .gradio-container .gr-chatbot {
234
+ background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(248,250,252,0.95) 100%) !important;
235
+ color: #334155 !important;
236
+ }
237
+
238
+ .gradio-container .chat-input-box textarea {
239
+ background: rgba(255,255,255,0.9) !important;
240
+ color: #334155 !important;
241
+ }
242
+
243
+ .gradio-container #app-header .app-subtitle {
244
+ color: #64748b !important;
245
+ }
246
+
247
+ /* Force light theme for all buttons and inputs */
248
+ .gradio-container button {
249
+ color-scheme: light !important;
250
+ }
251
+
252
+ .gradio-container input,
253
+ .gradio-container textarea {
254
+ color-scheme: light !important;
255
+ }
256
+ }