yingzhac commited on
Commit
97b66ab
·
1 Parent(s): 27bf03c

修复文字对比度问题 - 提升UI可读性

Browse files

- 为主容器添加深色文字(#333)以适配浅色背景
- 确保输入/输出区域在深色梯度背景上使用白色文字
- 改善描述文字颜色对比度
- 为所有Gradio组件添加明确的文字颜色规则
- 解决白字在浅色背景上不可见的问题

Files changed (1) hide show
  1. app.py +50 -1
app.py CHANGED
@@ -164,6 +164,7 @@ css = """
164
  #col-container {
165
  margin: 0 auto;
166
  max-width: 1000px;
 
167
  }
168
 
169
  #input-section {
@@ -171,16 +172,19 @@ css = """
171
  padding: 20px;
172
  border-radius: 15px;
173
  margin-bottom: 20px;
 
174
  }
175
 
176
  #output-section {
177
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
178
  padding: 20px;
179
  border-radius: 15px;
 
180
  }
181
 
182
  .gradio-container {
183
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
 
184
  }
185
 
186
  #title {
@@ -195,7 +199,7 @@ css = """
195
 
196
  #description {
197
  text-align: center;
198
- color: #666;
199
  font-size: 1.1em;
200
  margin-bottom: 30px;
201
  line-height: 1.6;
@@ -216,6 +220,51 @@ css = """
216
  transform: translateY(-2px);
217
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  """
220
 
221
  # Create the Gradio interface
 
164
  #col-container {
165
  margin: 0 auto;
166
  max-width: 1000px;
167
+ color: #333;
168
  }
169
 
170
  #input-section {
 
172
  padding: 20px;
173
  border-radius: 15px;
174
  margin-bottom: 20px;
175
+ color: white;
176
  }
177
 
178
  #output-section {
179
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
180
  padding: 20px;
181
  border-radius: 15px;
182
+ color: white;
183
  }
184
 
185
  .gradio-container {
186
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
187
+ color: #333;
188
  }
189
 
190
  #title {
 
199
 
200
  #description {
201
  text-align: center;
202
+ color: #444;
203
  font-size: 1.1em;
204
  margin-bottom: 30px;
205
  line-height: 1.6;
 
220
  transform: translateY(-2px);
221
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
222
  }
223
+
224
+ /* Additional text contrast improvements */
225
+ .gradio-container label {
226
+ color: #333 !important;
227
+ font-weight: 500;
228
+ }
229
+
230
+ .gradio-container .gr-form {
231
+ color: #333 !important;
232
+ }
233
+
234
+ .gradio-container .gr-text-input {
235
+ color: #333 !important;
236
+ }
237
+
238
+ .gradio-container .gr-button {
239
+ color: #333 !important;
240
+ }
241
+
242
+ #input-section label,
243
+ #input-section .gr-form,
244
+ #input-section .gr-text-input,
245
+ #input-section .gr-button {
246
+ color: white !important;
247
+ }
248
+
249
+ #output-section label,
250
+ #output-section .gr-form,
251
+ #output-section .gr-text-input,
252
+ #output-section .gr-button {
253
+ color: white !important;
254
+ }
255
+
256
+ /* Make sure markdown text is readable */
257
+ .gradio-container .gr-markdown {
258
+ color: #333 !important;
259
+ }
260
+
261
+ #input-section .gr-markdown {
262
+ color: white !important;
263
+ }
264
+
265
+ #output-section .gr-markdown {
266
+ color: white !important;
267
+ }
268
  """
269
 
270
  # Create the Gradio interface