Spaces:
Runtime error
Runtime error
Rename theme.jason to theme.py
Browse files- theme.jason +0 -71
- theme.py +90 -0
theme.jason
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
greta_theme = gr.themes.Soft(
|
4 |
-
primary_hue="lime",
|
5 |
-
secondary_hue="emerald",
|
6 |
-
neutral_hue="stone",
|
7 |
-
font=[gr.themes.GoogleFont('Source Sans Pro'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
8 |
-
).set(
|
9 |
-
body_background_fill='*primary_50',
|
10 |
-
body_background_fill_dark='*neutral_950',
|
11 |
-
background_fill_primary='*primary_100',
|
12 |
-
shadow_drop='rgba(0,0,0,0.05) 0px 1px 2px 0px',
|
13 |
-
shadow_drop_lg='0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)',
|
14 |
-
shadow_spread='3px',
|
15 |
-
block_background_fill='*background_fill_primary',
|
16 |
-
block_border_width='1px',
|
17 |
-
block_border_width_dark='1px',
|
18 |
-
block_label_background_fill='*background_fill_primary',
|
19 |
-
block_label_background_fill_dark='*background_fill_secondary',
|
20 |
-
block_label_text_color='*neutral_500',
|
21 |
-
block_label_text_color_dark='*neutral_200',
|
22 |
-
block_label_margin='0',
|
23 |
-
block_label_padding='*spacing_sm *spacing_lg',
|
24 |
-
block_label_radius='calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0',
|
25 |
-
block_label_text_size='*text_sm',
|
26 |
-
block_label_text_weight='400',
|
27 |
-
block_title_background_fill='none',
|
28 |
-
block_title_background_fill_dark='none',
|
29 |
-
block_title_text_color='*neutral_500',
|
30 |
-
block_title_text_color_dark='*neutral_200',
|
31 |
-
block_title_padding='0',
|
32 |
-
block_title_radius='none',
|
33 |
-
block_title_text_weight='400',
|
34 |
-
panel_border_width='0',
|
35 |
-
panel_border_width_dark='0',
|
36 |
-
checkbox_background_color_selected='*secondary_600',
|
37 |
-
checkbox_background_color_selected_dark='*secondary_600',
|
38 |
-
checkbox_border_color='*neutral_300',
|
39 |
-
checkbox_border_color_dark='*neutral_700',
|
40 |
-
checkbox_border_color_focus='*secondary_500',
|
41 |
-
checkbox_border_color_focus_dark='*secondary_500',
|
42 |
-
checkbox_border_color_selected='*secondary_600',
|
43 |
-
checkbox_border_color_selected_dark='*secondary_600',
|
44 |
-
checkbox_border_width='*input_border_width',
|
45 |
-
checkbox_shadow='*input_shadow',
|
46 |
-
checkbox_label_background_fill_selected='*checkbox_label_background_fill',
|
47 |
-
checkbox_label_background_fill_selected_dark='*checkbox_label_background_fill',
|
48 |
-
checkbox_label_shadow='none',
|
49 |
-
checkbox_label_text_color_selected='*checkbox_label_text_color',
|
50 |
-
input_background_fill='*neutral_100',
|
51 |
-
input_border_color='*border_color_primary',
|
52 |
-
input_shadow='none',
|
53 |
-
input_shadow_dark='none',
|
54 |
-
input_shadow_focus='*input_shadow',
|
55 |
-
input_shadow_focus_dark='*input_shadow',
|
56 |
-
slider_color='#2563eb',
|
57 |
-
slider_color_dark='#2563eb',
|
58 |
-
button_shadow='none',
|
59 |
-
button_shadow_active='none',
|
60 |
-
button_shadow_hover='none',
|
61 |
-
button_primary_background_fill='*primary_200',
|
62 |
-
button_primary_background_fill_hover='*button_primary_background_fill',
|
63 |
-
button_primary_background_fill_hover_dark='*button_primary_background_fill',
|
64 |
-
button_primary_text_color='*primary_600',
|
65 |
-
button_secondary_background_fill='*neutral_200',
|
66 |
-
button_secondary_background_fill_hover='*button_secondary_background_fill',
|
67 |
-
button_secondary_background_fill_hover_dark='*button_secondary_background_fill',
|
68 |
-
button_secondary_text_color='*neutral_700',
|
69 |
-
button_cancel_background_fill_hover='*button_cancel_background_fill',
|
70 |
-
button_cancel_background_fill_hover_dark='*button_cancel_background_fill'
|
71 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theme.py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from __future__ import annotations
|
3 |
+
|
4 |
+
from typing import Iterable
|
5 |
+
|
6 |
+
from gradio.themes.base import Base
|
7 |
+
from gradio.themes.utils import colors, fonts, sizes
|
8 |
+
|
9 |
+
|
10 |
+
class Theme(Base):
|
11 |
+
def __init__(
|
12 |
+
self,
|
13 |
+
*,
|
14 |
+
primary_hue: colors.Color | str = colors.lime,
|
15 |
+
secondary_hue: colors.Color | str = colors.emerald,
|
16 |
+
neutral_hue: colors.Color | str = colors.neutral,
|
17 |
+
spacing_size: sizes.Size | str = sizes.spacing_lg,
|
18 |
+
radius_size: sizes.Size | str = sizes.radius_none,
|
19 |
+
text_size: sizes.Size | str = sizes.text_md,
|
20 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
21 |
+
fonts.GoogleFont("Quicksand"),
|
22 |
+
"ui-sans-serif",
|
23 |
+
"system-ui",
|
24 |
+
"sans-serif",
|
25 |
+
),
|
26 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
27 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
28 |
+
"ui-monospace",
|
29 |
+
"Consolas",
|
30 |
+
"monospace",
|
31 |
+
),
|
32 |
+
):
|
33 |
+
super().__init__(
|
34 |
+
primary_hue=primary_hue,
|
35 |
+
secondary_hue=secondary_hue,
|
36 |
+
neutral_hue=neutral_hue,
|
37 |
+
spacing_size=spacing_size,
|
38 |
+
radius_size=radius_size,
|
39 |
+
text_size=text_size,
|
40 |
+
font=font,
|
41 |
+
font_mono=font_mono,
|
42 |
+
)
|
43 |
+
self.name = "theme"
|
44 |
+
super().set(
|
45 |
+
# Colors
|
46 |
+
slider_color="*neutral_900",
|
47 |
+
slider_color_dark="*neutral_500",
|
48 |
+
body_text_color="*neutral_900",
|
49 |
+
block_label_text_color="*body_text_color",
|
50 |
+
block_title_text_color="*body_text_color",
|
51 |
+
body_text_color_subdued="*neutral_700",
|
52 |
+
background_fill_primary_dark="*neutral_900",
|
53 |
+
background_fill_secondary_dark="*neutral_800",
|
54 |
+
block_background_fill_dark="*neutral_800",
|
55 |
+
input_background_fill_dark="*neutral_700",
|
56 |
+
# Button Colors
|
57 |
+
button_primary_background_fill="*neutral_900",
|
58 |
+
button_primary_background_fill_hover="*neutral_700",
|
59 |
+
button_primary_text_color="white",
|
60 |
+
button_primary_background_fill_dark="*neutral_600",
|
61 |
+
button_primary_background_fill_hover_dark="*neutral_600",
|
62 |
+
button_primary_text_color_dark="white",
|
63 |
+
button_secondary_background_fill="*button_primary_background_fill",
|
64 |
+
button_secondary_background_fill_hover="*button_primary_background_fill_hover",
|
65 |
+
button_secondary_text_color="*button_primary_text_color",
|
66 |
+
button_cancel_background_fill="*button_primary_background_fill",
|
67 |
+
button_cancel_background_fill_hover="*button_primary_background_fill_hover",
|
68 |
+
button_cancel_text_color="*button_primary_text_color",
|
69 |
+
checkbox_label_background_fill="*button_primary_background_fill",
|
70 |
+
checkbox_label_background_fill_hover="*button_primary_background_fill_hover",
|
71 |
+
checkbox_label_text_color="*button_primary_text_color",
|
72 |
+
checkbox_background_color_selected="*neutral_600",
|
73 |
+
checkbox_background_color_dark="*neutral_700",
|
74 |
+
checkbox_background_color_selected_dark="*neutral_700",
|
75 |
+
checkbox_border_color_selected_dark="*neutral_800",
|
76 |
+
# Padding
|
77 |
+
checkbox_label_padding="*spacing_md",
|
78 |
+
button_large_padding="*spacing_lg",
|
79 |
+
button_small_padding="*spacing_sm",
|
80 |
+
# Borders
|
81 |
+
block_border_width="0px",
|
82 |
+
block_border_width_dark="1px",
|
83 |
+
shadow_drop_lg="0 1px 4px 0 rgb(0 0 0 / 0.1)",
|
84 |
+
block_shadow="*shadow_drop_lg",
|
85 |
+
block_shadow_dark="none",
|
86 |
+
# Block Labels
|
87 |
+
block_title_text_weight="600",
|
88 |
+
block_label_text_weight="600",
|
89 |
+
block_label_text_size="*text_md",
|
90 |
+
)
|