prithivMLmods commited on
Commit
a78ad30
Β·
verified Β·
1 Parent(s): 7a4b674

update app [theme]

Browse files
Files changed (1) hide show
  1. app.py +70 -37
app.py CHANGED
@@ -45,27 +45,29 @@ from typing import Iterable
45
  from gradio.themes import Soft
46
  from gradio.themes.utils import colors, fonts, sizes
47
 
48
- colors.orange_red = colors.Color(
49
- name="orange_red",
50
- c50="#FFF0E5",
51
- c100="#FFE0CC",
52
- c200="#FFC299",
53
- c300="#FFA366",
54
- c400="#FF8533",
55
- c500="#FF4500",
56
- c600="#E63E00",
57
- c700="#CC3700",
58
- c800="#B33000",
59
- c900="#992900",
60
- c950="#802200",
 
61
  )
62
 
63
- class OrangeRedTheme(Soft):
 
64
  def __init__(
65
  self,
66
  *,
67
  primary_hue: colors.Color | str = colors.gray,
68
- secondary_hue: colors.Color | str = colors.orange_red,
69
  neutral_hue: colors.Color | str = colors.slate,
70
  text_size: sizes.Size | str = sizes.text_lg,
71
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
@@ -92,8 +94,8 @@ class OrangeRedTheme(Soft):
92
  button_primary_text_color_hover="white",
93
  button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
94
  button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
95
- button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
96
- button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
97
  button_secondary_text_color="black",
98
  button_secondary_text_color_hover="white",
99
  button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
@@ -112,7 +114,7 @@ class OrangeRedTheme(Soft):
112
  )
113
 
114
 
115
- orange_red_theme = OrangeRedTheme()
116
 
117
  SVG_CUBE = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"/></svg>'
118
 
@@ -173,13 +175,13 @@ footer { display: none !important; }
173
 
174
  /* ── App Header ── */
175
  .app-header {
176
- background: linear-gradient(135deg, #4A1800 0%, #802200 30%, #CC3700 70%, #FF4500 100%);
177
  border-radius: 16px;
178
  padding: 32px 40px;
179
  margin-bottom: 24px;
180
  position: relative;
181
  overflow: hidden;
182
- box-shadow: 0 8px 32px rgba(74, 24, 0, 0.25);
183
  }
184
  .app-header::before {
185
  content: '';
@@ -198,7 +200,7 @@ footer { display: none !important; }
198
  left: -10%;
199
  width: 300px;
200
  height: 300px;
201
- background: radial-gradient(circle, rgba(255, 69, 0, 0.15) 0%, transparent 70%);
202
  border-radius: 50%;
203
  }
204
  .header-content {
@@ -220,16 +222,25 @@ footer { display: none !important; }
220
  backdrop-filter: blur(8px);
221
  border: 1px solid rgba(255, 255, 255, 0.15);
222
  }
223
- .header-icon-wrap svg {
 
 
224
  width: 36px;
225
  height: 36px;
226
- color: rgba(255, 255, 255, 0.9);
 
 
 
 
 
 
 
227
  }
228
  .header-text h1 {
229
  font-family: 'Outfit', sans-serif;
230
  font-size: 2rem;
231
  font-weight: 700;
232
- color: #fff;
233
  margin: 0 0 8px 0;
234
  letter-spacing: -0.02em;
235
  line-height: 1.2;
@@ -245,7 +256,7 @@ footer { display: none !important; }
245
  align-items: center;
246
  gap: 6px;
247
  background: rgba(255, 255, 255, 0.12);
248
- color: rgba(255, 255, 255, 0.9);
249
  padding: 4px 12px;
250
  border-radius: 20px;
251
  font-family: 'IBM Plex Mono', monospace;
@@ -254,10 +265,6 @@ footer { display: none !important; }
254
  border: 1px solid rgba(255, 255, 255, 0.1);
255
  backdrop-filter: blur(4px);
256
  }
257
- .meta-badge svg {
258
- width: 14px;
259
- height: 14px;
260
- }
261
  .meta-sep {
262
  width: 4px;
263
  height: 4px;
@@ -266,7 +273,7 @@ footer { display: none !important; }
266
  flex-shrink: 0;
267
  }
268
  .meta-cap {
269
- color: rgba(255, 255, 255, 0.65);
270
  font-size: 0.85rem;
271
  font-weight: 400;
272
  }
@@ -322,7 +329,7 @@ footer { display: none !important; }
322
  }
323
  .primary:hover {
324
  transform: translateY(-2px) !important;
325
- box-shadow: 0 6px 20px rgba(255, 69, 0, 0.3) !important;
326
  }
327
  .primary:active { transform: translateY(0) !important; }
328
 
@@ -410,7 +417,7 @@ footer { display: none !important; }
410
  /* ── Accordion ── */
411
  .gradio-accordion {
412
  border-radius: 10px !important;
413
- border: 1px solid rgba(255, 69, 0, 0.15) !important;
414
  }
415
  .gradio-accordion > .label-wrap { border-radius: 10px !important; }
416
 
@@ -421,18 +428,44 @@ label {
421
  }
422
 
423
  /* ── Slider ── */
424
- .gradio-slider input[type="range"] { accent-color: #FF4500 !important; }
425
 
426
  /* ── Scrollbar ── */
427
  ::-webkit-scrollbar { width: 8px; height: 8px; }
428
- ::-webkit-scrollbar-track { background: rgba(255, 69, 0, 0.04); border-radius: 4px; }
429
  ::-webkit-scrollbar-thumb {
430
- background: linear-gradient(135deg, #FF4500, #CC3700);
431
  border-radius: 4px;
432
  }
433
  ::-webkit-scrollbar-thumb:hover {
434
- background: linear-gradient(135deg, #CC3700, #992900);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
 
 
436
 
437
  /* ── Responsive ── */
438
  @media (max-width: 768px) {
@@ -1358,4 +1391,4 @@ with gr.Blocks() as demo:
1358
  outputs=[measure_image, measure_points_state],
1359
  )
1360
 
1361
- demo.queue(max_size=50).launch(css=CUSTOM_CSS, theme=orange_red_theme, show_error=True, share=True, ssr_mode=False)
 
45
  from gradio.themes import Soft
46
  from gradio.themes.utils import colors, fonts, sizes
47
 
48
+ # ── Steel-Blue palette ──────────────────────────────────────────────
49
+ colors.steel_blue = colors.Color(
50
+ name="steel_blue",
51
+ c50="#EBF3F8",
52
+ c100="#D3E5F0",
53
+ c200="#A8CCE1",
54
+ c300="#7DB3D2",
55
+ c400="#529AC3",
56
+ c500="#4682B4",
57
+ c600="#3E72A0",
58
+ c700="#36638C",
59
+ c800="#2E5378",
60
+ c900="#264364",
61
+ c950="#1E3450",
62
  )
63
 
64
+
65
+ class SteelBlueTheme(Soft):
66
  def __init__(
67
  self,
68
  *,
69
  primary_hue: colors.Color | str = colors.gray,
70
+ secondary_hue: colors.Color | str = colors.steel_blue,
71
  neutral_hue: colors.Color | str = colors.slate,
72
  text_size: sizes.Size | str = sizes.text_lg,
73
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
 
94
  button_primary_text_color_hover="white",
95
  button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
96
  button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
97
+ button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
98
+ button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
99
  button_secondary_text_color="black",
100
  button_secondary_text_color_hover="white",
101
  button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
 
114
  )
115
 
116
 
117
+ steel_blue_theme = SteelBlueTheme()
118
 
119
  SVG_CUBE = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"/></svg>'
120
 
 
175
 
176
  /* ── App Header ── */
177
  .app-header {
178
+ background: linear-gradient(135deg, #1E3450 0%, #264364 30%, #3E72A0 70%, #4682B4 100%);
179
  border-radius: 16px;
180
  padding: 32px 40px;
181
  margin-bottom: 24px;
182
  position: relative;
183
  overflow: hidden;
184
+ box-shadow: 0 8px 32px rgba(30, 52, 80, 0.35);
185
  }
186
  .app-header::before {
187
  content: '';
 
200
  left: -10%;
201
  width: 300px;
202
  height: 300px;
203
+ background: radial-gradient(circle, rgba(70, 130, 180, 0.15) 0%, transparent 70%);
204
  border-radius: 50%;
205
  }
206
  .header-content {
 
222
  backdrop-filter: blur(8px);
223
  border: 1px solid rgba(255, 255, 255, 0.15);
224
  }
225
+ /* ── Force header SVGs white in ALL modes ── */
226
+ .header-icon-wrap svg,
227
+ .app-header svg {
228
  width: 36px;
229
  height: 36px;
230
+ color: #ffffff !important;
231
+ stroke: #ffffff !important;
232
+ }
233
+ .meta-badge svg {
234
+ width: 14px !important;
235
+ height: 14px !important;
236
+ color: #ffffff !important;
237
+ stroke: #ffffff !important;
238
  }
239
  .header-text h1 {
240
  font-family: 'Outfit', sans-serif;
241
  font-size: 2rem;
242
  font-weight: 700;
243
+ color: #fff !important;
244
  margin: 0 0 8px 0;
245
  letter-spacing: -0.02em;
246
  line-height: 1.2;
 
256
  align-items: center;
257
  gap: 6px;
258
  background: rgba(255, 255, 255, 0.12);
259
+ color: rgba(255, 255, 255, 0.9) !important;
260
  padding: 4px 12px;
261
  border-radius: 20px;
262
  font-family: 'IBM Plex Mono', monospace;
 
265
  border: 1px solid rgba(255, 255, 255, 0.1);
266
  backdrop-filter: blur(4px);
267
  }
 
 
 
 
268
  .meta-sep {
269
  width: 4px;
270
  height: 4px;
 
273
  flex-shrink: 0;
274
  }
275
  .meta-cap {
276
+ color: rgba(255, 255, 255, 0.65) !important;
277
  font-size: 0.85rem;
278
  font-weight: 400;
279
  }
 
329
  }
330
  .primary:hover {
331
  transform: translateY(-2px) !important;
332
+ box-shadow: 0 6px 20px rgba(70, 130, 180, 0.35) !important;
333
  }
334
  .primary:active { transform: translateY(0) !important; }
335
 
 
417
  /* ── Accordion ── */
418
  .gradio-accordion {
419
  border-radius: 10px !important;
420
+ border: 1px solid rgba(70, 130, 180, 0.2) !important;
421
  }
422
  .gradio-accordion > .label-wrap { border-radius: 10px !important; }
423
 
 
428
  }
429
 
430
  /* ── Slider ── */
431
+ .gradio-slider input[type="range"] { accent-color: #4682B4 !important; }
432
 
433
  /* ── Scrollbar ── */
434
  ::-webkit-scrollbar { width: 8px; height: 8px; }
435
+ ::-webkit-scrollbar-track { background: rgba(70, 130, 180, 0.06); border-radius: 4px; }
436
  ::-webkit-scrollbar-thumb {
437
+ background: linear-gradient(135deg, #4682B4, #3E72A0);
438
  border-radius: 4px;
439
  }
440
  ::-webkit-scrollbar-thumb:hover {
441
+ background: linear-gradient(135deg, #3E72A0, #2E5378);
442
+ }
443
+
444
+ /* ── Dark-mode overrides for header (keep text/SVG white) ── */
445
+ @media (prefers-color-scheme: dark) {
446
+ .app-header {
447
+ background: linear-gradient(135deg, #1E3450 0%, #264364 30%, #3E72A0 70%, #4682B4 100%);
448
+ }
449
+ .header-text h1 { color: #fff !important; }
450
+ .header-icon-wrap svg,
451
+ .app-header svg,
452
+ .meta-badge svg {
453
+ color: #ffffff !important;
454
+ stroke: #ffffff !important;
455
+ }
456
+ .meta-badge { color: rgba(255, 255, 255, 0.9) !important; }
457
+ .meta-cap { color: rgba(255, 255, 255, 0.65) !important; }
458
+ }
459
+ /* Also handle Gradio's own .dark class */
460
+ .dark .header-text h1 { color: #fff !important; }
461
+ .dark .header-icon-wrap svg,
462
+ .dark .app-header svg,
463
+ .dark .meta-badge svg {
464
+ color: #ffffff !important;
465
+ stroke: #ffffff !important;
466
  }
467
+ .dark .meta-badge { color: rgba(255, 255, 255, 0.9) !important; }
468
+ .dark .meta-cap { color: rgba(255, 255, 255, 0.65) !important; }
469
 
470
  /* ── Responsive ── */
471
  @media (max-width: 768px) {
 
1391
  outputs=[measure_image, measure_points_state],
1392
  )
1393
 
1394
+ demo.queue(max_size=50).launch(css=CUSTOM_CSS, theme=steel_blue_theme, show_error=True, share=True, ssr_mode=False, mcp_server=True)