Spaces:
Runtime error
Runtime error
app22
Browse files
theme.py
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
from typing import Iterable
|
4 |
+
|
5 |
+
from gradio.themes.base import Base
|
6 |
+
from gradio.themes.utils import colors, fonts, sizes
|
7 |
+
|
8 |
+
|
9 |
+
class Theme(Base):
|
10 |
+
def __init__(
|
11 |
+
self,
|
12 |
+
*,
|
13 |
+
primary_hue: colors.Color | str = colors.lime,
|
14 |
+
secondary_hue: colors.Color | str = colors.emerald,
|
15 |
+
neutral_hue: colors.Color | str = colors.stone,
|
16 |
+
spacing_size: sizes.Size | str = sizes.spacing_lg,
|
17 |
+
radius_size: sizes.Size | str = sizes.radius_none,
|
18 |
+
text_size: sizes.Size | str = sizes.text_md,
|
19 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
20 |
+
fonts.GoogleFont("Quicksand"),
|
21 |
+
"ui-sans-serif",
|
22 |
+
"system-ui",
|
23 |
+
"sans-serif",
|
24 |
+
),
|
25 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
26 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
27 |
+
"ui-monospace",
|
28 |
+
"Consolas",
|
29 |
+
"monospace",
|
30 |
+
),
|
31 |
+
):
|
32 |
+
super().__init__(
|
33 |
+
primary_hue=primary_hue,
|
34 |
+
secondary_hue=secondary_hue,
|
35 |
+
neutral_hue=neutral_hue,
|
36 |
+
spacing_size=spacing_size,
|
37 |
+
radius_size=radius_size,
|
38 |
+
text_size=text_size,
|
39 |
+
font=font,
|
40 |
+
font_mono=font_mono,
|
41 |
+
)
|
42 |
+
self.name = "theme"
|
43 |
+
super().set(
|
44 |
+
# Colors
|
45 |
+
slider_color="*neutral_900",
|
46 |
+
slider_color_dark="*neutral_500",
|
47 |
+
body_text_color="rgb(18,13,5)",
|
48 |
+
block_label_text_color="rgb(243, 239, 224)",
|
49 |
+
block_title_text_color="rgb(243, 239, 224)",
|
50 |
+
body_text_color_subdued="*neutral_400",
|
51 |
+
body_background_fill='*primary_800',
|
52 |
+
background_fill_primary='*primary_600',
|
53 |
+
background_fill_primary_dark='*primary_900',
|
54 |
+
background_fill_secondary_dark='*primary_900',
|
55 |
+
block_background_fill='rgb(53,66,48)',
|
56 |
+
block_background_fill_dark="*neutral_800",
|
57 |
+
input_background_fill_dark="*neutral_700",
|
58 |
+
# Button Colors
|
59 |
+
button_primary_background_fill="rgb(53,66,48)",
|
60 |
+
button_primary_background_fill_hover='*primary_200',
|
61 |
+
button_primary_text_color='*primary_600',
|
62 |
+
button_primary_background_fill_dark="*neutral_600",
|
63 |
+
button_primary_background_fill_hover_dark="*neutral_600",
|
64 |
+
button_primary_text_color_dark="white",
|
65 |
+
button_secondary_background_fill="*button_primary_background_fill",
|
66 |
+
button_secondary_background_fill_hover="*button_primary_background_fill_hover",
|
67 |
+
button_secondary_text_color="*button_primary_text_color",
|
68 |
+
button_cancel_background_fill="*button_primary_background_fill",
|
69 |
+
button_cancel_background_fill_hover="*button_primary_background_fill_hover",
|
70 |
+
button_cancel_text_color="*button_primary_text_color",
|
71 |
+
checkbox_label_background_fill="*button_primary_background_fill",
|
72 |
+
checkbox_label_background_fill_hover="*button_primary_background_fill_hover",
|
73 |
+
checkbox_label_text_color="*button_primary_text_color",
|
74 |
+
checkbox_background_color_selected="*neutral_600",
|
75 |
+
checkbox_background_color_dark="*neutral_700",
|
76 |
+
checkbox_background_color_selected_dark="*neutral_700",
|
77 |
+
checkbox_border_color_selected_dark="*neutral_800",
|
78 |
+
# Padding
|
79 |
+
checkbox_label_padding="*spacing_md",
|
80 |
+
button_large_padding="*spacing_lg",
|
81 |
+
button_small_padding="*spacing_sm",
|
82 |
+
# Borders
|
83 |
+
block_border_width="0px",
|
84 |
+
block_border_width_dark="1px",
|
85 |
+
shadow_drop_lg="0 1px 4px 0 rgb(0 0 0 / 0.1)",
|
86 |
+
block_shadow="*shadow_drop_lg",
|
87 |
+
block_shadow_dark="none",
|
88 |
+
# Block Labels
|
89 |
+
block_title_text_weight="600",
|
90 |
+
block_label_text_weight="600",
|
91 |
+
block_label_text_size="*text_md",
|
92 |
+
)
|