Spaces:
Sleeping
Sleeping
changes to font color
Browse files- app.py +25 -16
- styles.css +44 -22
app.py
CHANGED
@@ -13,15 +13,15 @@ except UnicodeDecodeError:
|
|
13 |
with open("styles.css", "r", encoding="latin-1") as f:
|
14 |
custom_css = f.read()
|
15 |
|
16 |
-
# Add more specific selector for Gradio and add
|
17 |
additional_css = """
|
18 |
.gradio-container .checkbox-panel,
|
19 |
div.gradio-container [class*="block"] .checkbox-panel {
|
20 |
-
background-color: #
|
21 |
}
|
22 |
.gradio-container .search-panel,
|
23 |
div.gradio-container [class*="block"] .search-panel {
|
24 |
-
background-color: #
|
25 |
}
|
26 |
"""
|
27 |
custom_css += additional_css
|
@@ -35,28 +35,31 @@ class CustomTheme(gr.themes.Base):
|
|
35 |
neutral_hue=colors.gray,
|
36 |
text_size=gr.themes.sizes.text_lg
|
37 |
)
|
38 |
-
#
|
39 |
self.block_border_width = "0px"
|
40 |
self.block_shadow = "none"
|
|
|
|
|
|
|
41 |
|
42 |
-
# Add additional CSS for the new styles,
|
43 |
custom_css += """
|
44 |
/* Only override specific panels by ID */
|
45 |
#checkbox-panel,
|
46 |
#search-panel {
|
47 |
-
background-color: #
|
48 |
}
|
49 |
|
50 |
/* Only affect immediate children of these specific panels */
|
51 |
#checkbox-panel > *,
|
52 |
#search-panel > * {
|
53 |
-
background-color:
|
54 |
}
|
55 |
|
56 |
/* Target checkbox inputs specifically */
|
57 |
#checkbox-panel input[type="checkbox"],
|
58 |
#search-panel input[type="text"] {
|
59 |
-
background-color:
|
60 |
}
|
61 |
"""
|
62 |
|
@@ -613,7 +616,7 @@ with gr.Blocks(css=css, title="TD-EVAL Leaderboard", theme=custom_theme) as demo
|
|
613 |
# JavaScript to change panel backgrounds
|
614 |
searchpanel_js = """
|
615 |
function applyStyles() {
|
616 |
-
// Add a style tag to the head to ensure textarea text color
|
617 |
var styleElement = document.createElement('style');
|
618 |
styleElement.textContent = `
|
619 |
textarea,
|
@@ -622,6 +625,17 @@ function applyStyles() {
|
|
622 |
textarea.svelte-173056l {
|
623 |
color: #000000 !important;
|
624 |
caret-color: #000000 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
}
|
626 |
`;
|
627 |
document.head.appendChild(styleElement);
|
@@ -629,16 +643,11 @@ function applyStyles() {
|
|
629 |
// Wait for the DOM to be fully loaded
|
630 |
var searchPanel = document.querySelector('.search-panel');
|
631 |
if (searchPanel) {
|
632 |
-
// Only focus on making the text black
|
633 |
-
|
634 |
-
// Target textarea elements which are often used for input
|
635 |
var searchTextarea = searchPanel.querySelector('textarea[data-testid="textbox"]');
|
636 |
if (searchTextarea) {
|
637 |
// ONLY set color, not background
|
638 |
-
searchTextarea.style
|
639 |
-
|
640 |
-
// Force the color to remain black through inline style with !important
|
641 |
-
searchTextarea.setAttribute('style', 'color: #000000 !important;');
|
642 |
}
|
643 |
}
|
644 |
}
|
|
|
13 |
with open("styles.css", "r", encoding="latin-1") as f:
|
14 |
custom_css = f.read()
|
15 |
|
16 |
+
# Add more specific selector for Gradio and add white backgrounds
|
17 |
additional_css = """
|
18 |
.gradio-container .checkbox-panel,
|
19 |
div.gradio-container [class*="block"] .checkbox-panel {
|
20 |
+
background-color: #FFFFFF !important;
|
21 |
}
|
22 |
.gradio-container .search-panel,
|
23 |
div.gradio-container [class*="block"] .search-panel {
|
24 |
+
background-color: #FFFFFF !important;
|
25 |
}
|
26 |
"""
|
27 |
custom_css += additional_css
|
|
|
35 |
neutral_hue=colors.gray,
|
36 |
text_size=gr.themes.sizes.text_lg
|
37 |
)
|
38 |
+
# Set global background colors to white
|
39 |
self.block_border_width = "0px"
|
40 |
self.block_shadow = "none"
|
41 |
+
self.block_background_fill = "#FFFFFF"
|
42 |
+
self.background_fill_primary = "#FFFFFF"
|
43 |
+
self.background_fill_secondary = "#FFFFFF"
|
44 |
|
45 |
+
# Add additional CSS for the new styles, making everything white
|
46 |
custom_css += """
|
47 |
/* Only override specific panels by ID */
|
48 |
#checkbox-panel,
|
49 |
#search-panel {
|
50 |
+
background-color: #FFFFFF !important;
|
51 |
}
|
52 |
|
53 |
/* Only affect immediate children of these specific panels */
|
54 |
#checkbox-panel > *,
|
55 |
#search-panel > * {
|
56 |
+
background-color: #FFFFFF !important;
|
57 |
}
|
58 |
|
59 |
/* Target checkbox inputs specifically */
|
60 |
#checkbox-panel input[type="checkbox"],
|
61 |
#search-panel input[type="text"] {
|
62 |
+
background-color: #FFFFFF !important;
|
63 |
}
|
64 |
"""
|
65 |
|
|
|
616 |
# JavaScript to change panel backgrounds
|
617 |
searchpanel_js = """
|
618 |
function applyStyles() {
|
619 |
+
// Add a style tag to the head to ensure textarea text color only
|
620 |
var styleElement = document.createElement('style');
|
621 |
styleElement.textContent = `
|
622 |
textarea,
|
|
|
625 |
textarea.svelte-173056l {
|
626 |
color: #000000 !important;
|
627 |
caret-color: #000000 !important;
|
628 |
+
background-color: #FFFFFF !important;
|
629 |
+
}
|
630 |
+
|
631 |
+
/* Make all backgrounds white */
|
632 |
+
body, div, span, input, textarea, select, button {
|
633 |
+
background-color: #FFFFFF !important;
|
634 |
+
}
|
635 |
+
|
636 |
+
/* Ensure all text is black */
|
637 |
+
body, div, span, input, textarea, select, button, label, p, h1, h2, h3, h4, h5, h6 {
|
638 |
+
color: #000000 !important;
|
639 |
}
|
640 |
`;
|
641 |
document.head.appendChild(styleElement);
|
|
|
643 |
// Wait for the DOM to be fully loaded
|
644 |
var searchPanel = document.querySelector('.search-panel');
|
645 |
if (searchPanel) {
|
646 |
+
// Only focus on making the text black
|
|
|
|
|
647 |
var searchTextarea = searchPanel.querySelector('textarea[data-testid="textbox"]');
|
648 |
if (searchTextarea) {
|
649 |
// ONLY set color, not background
|
650 |
+
searchTextarea.setAttribute('style', 'color: #000000 !important; background-color: #FFFFFF !important;');
|
|
|
|
|
|
|
651 |
}
|
652 |
}
|
653 |
}
|
styles.css
CHANGED
@@ -41,7 +41,7 @@ h1 {
|
|
41 |
padding: 15px;
|
42 |
width: fit-content;
|
43 |
color: #000000 !important;
|
44 |
-
background-color: #
|
45 |
}
|
46 |
|
47 |
.variants_title {
|
@@ -50,7 +50,7 @@ h1 {
|
|
50 |
color: #000000 !important;
|
51 |
}
|
52 |
|
53 |
-
/* Force all descendants of the variants container to
|
54 |
.variants_container,
|
55 |
.variants_container * {
|
56 |
color: #000000 !important;
|
@@ -69,7 +69,7 @@ table {
|
|
69 |
}
|
70 |
|
71 |
table th {
|
72 |
-
background-color: #
|
73 |
color: #000000;
|
74 |
font-weight: bold;
|
75 |
font-size: 18px;
|
@@ -77,11 +77,11 @@ table th {
|
|
77 |
}
|
78 |
|
79 |
table tr:not(:first-child):nth-child(odd) {
|
80 |
-
background-color: #
|
81 |
}
|
82 |
|
83 |
table tr:not(:first-child):nth-child(even) {
|
84 |
-
background-color: #
|
85 |
}
|
86 |
|
87 |
table tr:not(:first-child):nth-child(odd) td {
|
@@ -123,14 +123,14 @@ button:hover {
|
|
123 |
|
124 |
/* Style the checkbox to have an orange checkmark */
|
125 |
input[type="checkbox"] {
|
126 |
-
accent-color: #
|
127 |
}
|
128 |
|
129 |
/* Create a custom appearance for checked checkboxes */
|
130 |
input[type="checkbox"]:checked {
|
131 |
position: relative;
|
132 |
appearance: none;
|
133 |
-
background-color: #
|
134 |
border: 1px solid #CCCCCC;
|
135 |
border-radius: 3px;
|
136 |
}
|
@@ -153,7 +153,7 @@ input[type="checkbox"]:checked::before {
|
|
153 |
text-align: center;
|
154 |
margin: 10px 0;
|
155 |
padding: 5px;
|
156 |
-
background-color: #
|
157 |
border-radius: 5px;
|
158 |
font-size: 16px;
|
159 |
}
|
@@ -169,7 +169,7 @@ input[type="checkbox"]:checked::before {
|
|
169 |
------------------------------------------------------------------ */
|
170 |
.gradio-container .checkbox-container {
|
171 |
margin-right: 10px;
|
172 |
-
background-color: #
|
173 |
padding: 8px;
|
174 |
border-radius: 5px;
|
175 |
}
|
@@ -199,11 +199,13 @@ textarea[data-testid="textbox"],
|
|
199 |
.scroll-hide,
|
200 |
.svelte-173056l {
|
201 |
color: #000000 !important;
|
|
|
202 |
}
|
203 |
|
204 |
/* Apply the style when typing and focused */
|
205 |
textarea[data-testid="textbox"]:focus {
|
206 |
color: #000000 !important;
|
|
|
207 |
}
|
208 |
|
209 |
/* ------------------------------------------------------------------
|
@@ -213,7 +215,7 @@ textarea[data-testid="textbox"]:focus {
|
|
213 |
color: #000000;
|
214 |
text-align: center;
|
215 |
padding: 30px;
|
216 |
-
background-color: #
|
217 |
border-radius: 10px;
|
218 |
font-size: 18px;
|
219 |
margin-top: 20px;
|
@@ -230,7 +232,7 @@ div.checkbox-panel,
|
|
230 |
div[id="checkbox-panel"],
|
231 |
.gradio-container div[id="checkbox-panel"],
|
232 |
.gradio-container .checkbox-panel {
|
233 |
-
background-color: #
|
234 |
padding: 12px !important;
|
235 |
border-radius: 6px !important;
|
236 |
margin-bottom: 1rem !important;
|
@@ -241,27 +243,27 @@ div.search-panel,
|
|
241 |
div[id="search-panel"],
|
242 |
.gradio-container div[id="search-panel"],
|
243 |
.gradio-container .search-panel {
|
244 |
-
background-color: #
|
245 |
padding: 12px !important;
|
246 |
border-radius: 6px !important;
|
247 |
margin-bottom: 1rem !important;
|
248 |
}
|
249 |
|
250 |
-
/* Make inner components
|
251 |
#checkbox-panel *, .checkbox-panel * {
|
252 |
-
background-color:
|
253 |
}
|
254 |
|
255 |
#search-panel *, .search-panel * {
|
256 |
-
background-color:
|
257 |
}
|
258 |
|
259 |
/* Override other styles that might be affecting the color */
|
260 |
div[class*="block"] {
|
261 |
-
background-color:
|
262 |
}
|
263 |
|
264 |
-
/*
|
265 |
.checkbox-panel .form,
|
266 |
.checkbox-panel .block,
|
267 |
.checkbox-panel .container,
|
@@ -270,12 +272,11 @@ div[class*="block"] {
|
|
270 |
.search-panel .block,
|
271 |
.search-panel .container,
|
272 |
.search-panel input[type="text"] {
|
273 |
-
background-color:
|
274 |
}
|
275 |
|
276 |
/* Make the textbox border visible with the same color as the text */
|
277 |
-
.search-panel input[type="text"]
|
278 |
-
.search-panel textarea[data-testid="textbox"] {
|
279 |
border: 2px solid #000000 !important;
|
280 |
background-color: #FFFFFF !important;
|
281 |
color: #000000 !important;
|
@@ -331,8 +332,8 @@ div[id="search-panel"] textarea,
|
|
331 |
|
332 |
/* Root level variable override */
|
333 |
:root {
|
334 |
-
--block-background-fill:
|
335 |
-
--panel-background-fill: #
|
336 |
}
|
337 |
|
338 |
/* Target the specific Gradio label element */
|
@@ -364,4 +365,25 @@ div[id="search-panel"] span {
|
|
364 |
div[id="search-panel"] span[data-testid="block-info"] {
|
365 |
color: #000000 !important;
|
366 |
font-weight: bold !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
|
|
41 |
padding: 15px;
|
42 |
width: fit-content;
|
43 |
color: #000000 !important;
|
44 |
+
background-color: #FFFFFF;
|
45 |
}
|
46 |
|
47 |
.variants_title {
|
|
|
50 |
color: #000000 !important;
|
51 |
}
|
52 |
|
53 |
+
/* Force all descendants of the variants container to have black text */
|
54 |
.variants_container,
|
55 |
.variants_container * {
|
56 |
color: #000000 !important;
|
|
|
69 |
}
|
70 |
|
71 |
table th {
|
72 |
+
background-color: #FFFFFF;
|
73 |
color: #000000;
|
74 |
font-weight: bold;
|
75 |
font-size: 18px;
|
|
|
77 |
}
|
78 |
|
79 |
table tr:not(:first-child):nth-child(odd) {
|
80 |
+
background-color: #FFFFFF;
|
81 |
}
|
82 |
|
83 |
table tr:not(:first-child):nth-child(even) {
|
84 |
+
background-color: #FFFFFF;
|
85 |
}
|
86 |
|
87 |
table tr:not(:first-child):nth-child(odd) td {
|
|
|
123 |
|
124 |
/* Style the checkbox to have an orange checkmark */
|
125 |
input[type="checkbox"] {
|
126 |
+
accent-color: #FFFFFF;
|
127 |
}
|
128 |
|
129 |
/* Create a custom appearance for checked checkboxes */
|
130 |
input[type="checkbox"]:checked {
|
131 |
position: relative;
|
132 |
appearance: none;
|
133 |
+
background-color: #FFFFFF;
|
134 |
border: 1px solid #CCCCCC;
|
135 |
border-radius: 3px;
|
136 |
}
|
|
|
153 |
text-align: center;
|
154 |
margin: 10px 0;
|
155 |
padding: 5px;
|
156 |
+
background-color: #FFFFFF;
|
157 |
border-radius: 5px;
|
158 |
font-size: 16px;
|
159 |
}
|
|
|
169 |
------------------------------------------------------------------ */
|
170 |
.gradio-container .checkbox-container {
|
171 |
margin-right: 10px;
|
172 |
+
background-color: #FFFFFF;
|
173 |
padding: 8px;
|
174 |
border-radius: 5px;
|
175 |
}
|
|
|
199 |
.scroll-hide,
|
200 |
.svelte-173056l {
|
201 |
color: #000000 !important;
|
202 |
+
background-color: #FFFFFF !important;
|
203 |
}
|
204 |
|
205 |
/* Apply the style when typing and focused */
|
206 |
textarea[data-testid="textbox"]:focus {
|
207 |
color: #000000 !important;
|
208 |
+
background-color: #FFFFFF !important;
|
209 |
}
|
210 |
|
211 |
/* ------------------------------------------------------------------
|
|
|
215 |
color: #000000;
|
216 |
text-align: center;
|
217 |
padding: 30px;
|
218 |
+
background-color: #FFFFFF;
|
219 |
border-radius: 10px;
|
220 |
font-size: 18px;
|
221 |
margin-top: 20px;
|
|
|
232 |
div[id="checkbox-panel"],
|
233 |
.gradio-container div[id="checkbox-panel"],
|
234 |
.gradio-container .checkbox-panel {
|
235 |
+
background-color: #FFFFFF !important;
|
236 |
padding: 12px !important;
|
237 |
border-radius: 6px !important;
|
238 |
margin-bottom: 1rem !important;
|
|
|
243 |
div[id="search-panel"],
|
244 |
.gradio-container div[id="search-panel"],
|
245 |
.gradio-container .search-panel {
|
246 |
+
background-color: #FFFFFF !important;
|
247 |
padding: 12px !important;
|
248 |
border-radius: 6px !important;
|
249 |
margin-bottom: 1rem !important;
|
250 |
}
|
251 |
|
252 |
+
/* Make inner components white */
|
253 |
#checkbox-panel *, .checkbox-panel * {
|
254 |
+
background-color: #FFFFFF !important;
|
255 |
}
|
256 |
|
257 |
#search-panel *, .search-panel * {
|
258 |
+
background-color: #FFFFFF !important;
|
259 |
}
|
260 |
|
261 |
/* Override other styles that might be affecting the color */
|
262 |
div[class*="block"] {
|
263 |
+
background-color: #FFFFFF !important;
|
264 |
}
|
265 |
|
266 |
+
/* Make all elements white */
|
267 |
.checkbox-panel .form,
|
268 |
.checkbox-panel .block,
|
269 |
.checkbox-panel .container,
|
|
|
272 |
.search-panel .block,
|
273 |
.search-panel .container,
|
274 |
.search-panel input[type="text"] {
|
275 |
+
background-color: #FFFFFF !important;
|
276 |
}
|
277 |
|
278 |
/* Make the textbox border visible with the same color as the text */
|
279 |
+
.search-panel input[type="text"] {
|
|
|
280 |
border: 2px solid #000000 !important;
|
281 |
background-color: #FFFFFF !important;
|
282 |
color: #000000 !important;
|
|
|
332 |
|
333 |
/* Root level variable override */
|
334 |
:root {
|
335 |
+
--block-background-fill: #FFFFFF !important;
|
336 |
+
--panel-background-fill: #FFFFFF !important;
|
337 |
}
|
338 |
|
339 |
/* Target the specific Gradio label element */
|
|
|
365 |
div[id="search-panel"] span[data-testid="block-info"] {
|
366 |
color: #000000 !important;
|
367 |
font-weight: bold !important;
|
368 |
+
}
|
369 |
+
|
370 |
+
/* Fix for block labels in gradio */
|
371 |
+
span[data-testid="block-info"] {
|
372 |
+
color: #000000 !important;
|
373 |
+
background-color: #FFFFFF !important;
|
374 |
+
}
|
375 |
+
|
376 |
+
/* Additional style to ensure text color in textareas and inputs is black */
|
377 |
+
textarea, input, textarea[data-testid="textbox"] {
|
378 |
+
color: #000000 !important;
|
379 |
+
}
|
380 |
+
|
381 |
+
/* Force black text color for search textbox */
|
382 |
+
.search-panel textarea,
|
383 |
+
textarea.scroll-hide,
|
384 |
+
textarea.svelte-173056l,
|
385 |
+
textarea[data-testid="textbox"] {
|
386 |
+
color: #000000 !important;
|
387 |
+
caret-color: #000000 !important;
|
388 |
+
background-color: #FFFFFF !important;
|
389 |
}
|