freddyaboulton HF staff commited on
Commit
f663f5c
1 Parent(s): 8b3d1ad

Updating theme

Browse files
Files changed (4) hide show
  1. README.md +3 -3
  2. app.py +19 -122
  3. requirements.txt +1 -1
  4. themes/theme_schema@0.1.1.json +1 -0
README.md CHANGED
@@ -1,11 +1,11 @@
1
 
2
  ---
3
  tags: [gradio-theme]
4
- title: dracula_revamped
5
- colorFrom: orange
6
  colorTo: purple
7
  sdk: gradio
8
- sdk_version: 3.20.1
9
  app_file: app.py
10
  pinned: false
11
  license: apache-2.0
 
1
 
2
  ---
3
  tags: [gradio-theme]
4
+ title: dracula_revamped
5
+ colorFrom: orange
6
  colorTo: purple
7
  sdk: gradio
8
+ sdk_version: 3.20.1
9
  app_file: app.py
10
  pinned: false
11
  license: apache-2.0
app.py CHANGED
@@ -1,73 +1,19 @@
1
- import gradio as gr
2
  import time
3
- from os.path import abspath, join, pardir
4
-
5
- KS_FILES = abspath(join(__file__, pardir, "files"))
6
 
7
- base_theme = gr.themes.Base()
8
- default_theme = gr.themes.Default()
9
- monochrome_theme = gr.themes.Monochrome()
10
- soft_theme = gr.themes.Soft()
11
- glass_theme = gr.themes.Glass()
12
 
13
  with gr.Blocks() as demo:
14
- gr.Markdown(
15
- """
16
- # Blocks Kitchen Sink
17
- This is a demo of most Gradio features. Test all themes and toogle dark mode (requires light mode setting)
18
- ## Elements
19
- - Use of Rows, Columns, Tabs, and Accordion
20
- - Use of Form elements: Textbox, Dropdown, Checkbox, Radio, Slider
21
- ## Other
22
- Other stuff
23
- - Buttons of variants: "primary", "secondary", "stop"
24
- - Embedded interface
25
- - Custom progress bar
26
- """
27
- )
28
  toggle_dark = gr.Button("Toggle Dark").style(full_width=False)
29
  toggle_dark.click(
30
  None,
31
  _js="""
32
- () => {
33
  document.body.classList.toggle('dark');
34
  document.querySelector('gradio-app').style.backgroundColor = 'var(--color-background-primary)'
35
  }
36
  """,
37
  )
38
- theme_selector = gr.Radio(
39
- ["Base", "Default", "Monochrome", "Soft", "Glass"],
40
- value="Default",
41
- label="Theme",
42
- )
43
- theme_selector.change(
44
- None,
45
- theme_selector,
46
- None,
47
- _js=f"""
48
- (theme) => {{
49
- if (!document.querySelector('.theme-css')) {{
50
- var theme_elem = document.createElement('style');
51
- theme_elem.classList.add('theme-css');
52
- document.head.appendChild(theme_elem);
53
- }} else {{
54
- var theme_elem = document.querySelector('.theme-css');
55
- }}
56
- if (theme == "Base") {{
57
- var theme_css = `{base_theme._get_theme_css()}`;
58
- }} else if (theme == "Default") {{
59
- var theme_css = `{default_theme._get_theme_css()}`;
60
- }} else if (theme == "Monochrome") {{
61
- var theme_css = `{monochrome_theme._get_theme_css()}`;
62
- }} else if (theme == "Soft") {{
63
- var theme_css = `{soft_theme._get_theme_css()}`;
64
- }} else if (theme == "Glass") {{
65
- var theme_css = `{glass_theme._get_theme_css()}`;
66
- }}
67
- theme_elem.innerHTML = theme_css;
68
- }}
69
- """,
70
- )
71
 
72
  name = gr.Textbox(
73
  label="Name",
@@ -128,37 +74,6 @@ with gr.Blocks() as demo:
128
  size="sm"
129
  )
130
 
131
- gr.Examples(
132
- examples=[join(KS_FILES, "lion.jpg"), join(KS_FILES, "tower.jpg")],
133
- inputs=img,
134
- )
135
-
136
- gr.Examples(
137
- examples=[
138
- ["A", "Option 1", ["Option B"], True, join(KS_FILES, "lion.jpg")],
139
- [
140
- "B",
141
- "Option 2",
142
- ["Option B", "Option C"],
143
- False,
144
- join(KS_FILES, "tower.jpg"),
145
- ],
146
- ],
147
- inputs=[radio, drop, drop_2, check, img],
148
- )
149
-
150
- gr.Markdown("## Media Files")
151
-
152
- with gr.Tab("Audio"):
153
- with gr.Row():
154
- gr.Audio()
155
- gr.Audio(source="microphone")
156
- gr.Audio(join(KS_FILES, "cantina.wav"))
157
- with gr.Tab("Other"):
158
- # gr.Image(source="webcam")
159
- gr.HTML(
160
- "<div style='width: 100px; height: 100px; background-color: blue;'></div>"
161
- )
162
  with gr.Row():
163
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
164
  gr.JSON(
@@ -168,12 +83,21 @@ with gr.Blocks() as demo:
168
  gr.File()
169
  with gr.Row():
170
  gr.ColorPicker()
171
- gr.Video(join(KS_FILES, "world.mp4"))
172
  gr.Gallery(
173
  [
174
- (join(KS_FILES, "lion.jpg"), "lion"),
175
- (join(KS_FILES, "logo.png"), "logo"),
176
- (join(KS_FILES, "tower.jpg"), "tower"),
 
 
 
 
 
 
 
 
 
177
  ]
178
  )
179
 
@@ -181,10 +105,12 @@ with gr.Blocks() as demo:
181
  with gr.Column(scale=2):
182
  chatbot = gr.Chatbot([["Hello", "Hi"]], label="Chatbot")
183
  chat_btn = gr.Button("Add messages")
 
184
  def chat(history):
185
  time.sleep(2)
186
  yield [["How are you?", "I am good."]]
187
  time
 
188
  chat_btn.click(
189
  lambda history: history
190
  + [["How are you?", "I am good."]]
@@ -199,35 +125,6 @@ with gr.Blocks() as demo:
199
  gr.Number(label="Chatbot control 2")
200
  gr.Number(label="Chatbot control 3")
201
 
202
- gr.Markdown("## Dataset Examples")
203
-
204
- component_example_set = [
205
- (gr.Audio(render=False), join(KS_FILES, "cantina.wav")),
206
- (gr.Checkbox(render=False), True),
207
- (gr.CheckboxGroup(render=False), ["A", "B"]),
208
- (gr.ColorPicker(render=False), "#FF0000"),
209
- (gr.Dataframe(render=False), [[1, 2, 3], [4, 5, 6]]),
210
- (gr.Dropdown(render=False), "A"),
211
- (gr.File(render=False), join(KS_FILES, "lion.jpg")),
212
- (gr.HTML(render=False), "<div>Test</div>"),
213
- (gr.Image(render=False), join(KS_FILES, "lion.jpg")),
214
- (gr.Markdown(render=False), "# Test"),
215
- (gr.Number(render=False), 1),
216
- (gr.Radio(render=False), "A"),
217
- (gr.Slider(render=False), 1),
218
- (gr.Textbox(render=False), "A"),
219
- (gr.Video(render=False), join(KS_FILES, "world.mp4")),
220
- ]
221
- gr.Dataset(
222
- components=[c for c, _ in component_example_set],
223
- samples=[[e for _, e in component_example_set]],
224
- )
225
-
226
- with gr.Tabs():
227
- for c, e in component_example_set:
228
- with gr.Tab(c.__class__.__name__):
229
- gr.Dataset(components=[c], samples=[[e]] * 3)
230
-
231
 
232
  if __name__ == "__main__":
233
- demo.queue().launch(file_directories=[KS_FILES])
 
 
1
  import time
 
 
 
2
 
3
+ import gradio as gr
 
 
 
 
4
 
5
  with gr.Blocks() as demo:
6
+ gr.Markdown("dracula_revamped Preview")
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  toggle_dark = gr.Button("Toggle Dark").style(full_width=False)
8
  toggle_dark.click(
9
  None,
10
  _js="""
11
+ () => {
12
  document.body.classList.toggle('dark');
13
  document.querySelector('gradio-app').style.backgroundColor = 'var(--color-background-primary)'
14
  }
15
  """,
16
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  name = gr.Textbox(
19
  label="Name",
 
74
  size="sm"
75
  )
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  with gr.Row():
78
  gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
79
  gr.JSON(
 
83
  gr.File()
84
  with gr.Row():
85
  gr.ColorPicker()
86
+ gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
87
  gr.Gallery(
88
  [
89
+ (
90
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
91
+ "lion",
92
+ ),
93
+ (
94
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
95
+ "logo",
96
+ ),
97
+ (
98
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
99
+ "tower",
100
+ ),
101
  ]
102
  )
103
 
 
105
  with gr.Column(scale=2):
106
  chatbot = gr.Chatbot([["Hello", "Hi"]], label="Chatbot")
107
  chat_btn = gr.Button("Add messages")
108
+
109
  def chat(history):
110
  time.sleep(2)
111
  yield [["How are you?", "I am good."]]
112
  time
113
+
114
  chat_btn.click(
115
  lambda history: history
116
  + [["How are you?", "I am good."]]
 
125
  gr.Number(label="Chatbot control 2")
126
  gr.Number(label="Chatbot control 3")
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  if __name__ == "__main__":
130
+ demo.queue().launch()
requirements.txt CHANGED
@@ -1 +1 @@
1
- https://gradio-builds.s3.amazonaws.com/theme-share/attempt-2/gradio-3.16.2-py3-none-any.whl
 
1
+ https://gradio-builds.s3.amazonaws.com/theme-share/attempt-4/gradio-3.20.1-py3-none-any.whl
themes/theme_schema@0.1.1.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"theme": {"block_background": "*color_background_primary", "block_background_dark": "*neutral_800", "block_border_color": "*color_border_primary", "block_border_color_dark": "*color_border_primary", "block_border_width": "1px", "block_border_width_dark": "1px", "block_info_color": "*text_color_subdued", "block_info_color_dark": "#f8f8f2", "block_info_color_size": "*text_sm", "block_info_color_weight": "400", "block_label_background": "*color_background_primary", "block_label_background_dark": "*color_background_secondary", "block_label_border_color": "*color_border_primary", "block_label_border_color_dark": "*color_border_primary", "block_label_border_width": "1px", "block_label_border_width_dark": "1px", "block_label_color": "#f8f8f2", "block_label_color_dark": "#f8f8f2", "block_label_icon_color": "*block_label_color", "block_label_margin": "0", "block_label_padding": "*spacing_sm *spacing_lg", "block_label_radius": "calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0", "block_label_right_radius": "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)", "block_label_text_size": "*text_sm", "block_label_text_weight": "400", "block_padding": "*spacing_xl calc(*spacing_xl + 2px)", "block_radius": "*radius_lg", "block_shadow": "none", "block_shadow_dark": "none", "block_title_background": "none", "block_title_background_dark": "none", "block_title_border_color": "none", "block_title_border_color_dark": "none", "block_title_border_width": "0px", "block_title_border_width_dark": "0px", "block_title_color": "#f8f8f2", "block_title_color_dark": "#f8f8f2", "block_title_padding": "0", "block_title_radius": "none", "block_title_text_size": "*text_md", "block_title_text_weight": "400", "body_background_color": "*color_background_primary", "body_background_color_dark": "*color_background_primary", "body_text_color": "#f8f8f2", "body_text_color_dark": "#f8f8f2", "body_text_size": "*text_md", "body_text_weight": "400", "button_border_width": "*input_border_width", "button_cancel_background": "#fecaca", "button_cancel_background_dark": "#b91c1c", "button_cancel_background_hover": "*button_cancel_background", "button_cancel_background_hover_dark": "*button_cancel_background_hover", "button_cancel_border_color": "#fecaca", "button_cancel_border_color_dark": "#dc2626", "button_cancel_border_color_hover": "*button_cancel_border_color", "button_cancel_border_color_hover_dark": "*button_cancel_border_color", "button_cancel_text_color": "#dc2626", "button_cancel_text_color_dark": "white", "button_cancel_text_color_hover": "*button_cancel_text_color", "button_cancel_text_color_hover_dark": "*button_cancel_text_color", "button_large_padding": "*spacing_lg calc(2 * *spacing_lg)", "button_large_radius": "*radius_lg", "button_large_text_size": "*text_lg", "button_large_text_weight": "600", "button_primary_background": "*primary_200", "button_primary_background_dark": "#ff79c6", "button_primary_background_hover": "*button_primary_background", "button_primary_background_hover_dark": "*button_primary_background", "button_primary_border_color": "*primary_200", "button_primary_border_color_dark": "*primary_600", "button_primary_border_color_hover": "*button_primary_border_color", "button_primary_border_color_hover_dark": "*button_primary_border_color", "button_primary_text_color": "*primary_600", "button_primary_text_color_dark": "white", "button_primary_text_color_hover": "*button_primary_text_color", "button_primary_text_color_hover_dark": "*button_primary_text_color", "button_secondary_background": "*neutral_200", "button_secondary_background_dark": "*neutral_600", "button_secondary_background_hover": "*button_secondary_background", "button_secondary_background_hover_dark": "*button_secondary_background", "button_secondary_border_color": "*neutral_200", "button_secondary_border_color_dark": "*neutral_600", "button_secondary_border_color_hover": "*button_secondary_border_color", "button_secondary_border_color_hover_dark": "*button_secondary_border_color", "button_secondary_text_color": "*neutral_700", "button_secondary_text_color_dark": "white", "button_secondary_text_color_hover": "*button_secondary_text_color", "button_secondary_text_color_hover_dark": "*button_secondary_text_color", "button_shadow": "none", "button_shadow_active": "none", "button_shadow_hover": "none", "button_small_padding": "*spacing_sm calc(2 * *spacing_sm)", "button_small_radius": "*radius_lg", "button_small_text_size": "*text_md", "button_small_text_weight": "400", "button_transition": "background-color 0.2s ease", "checkbox_background": "*color_background_primary", "checkbox_background_dark": "*neutral_800", "checkbox_background_focus": "*color_background_primary", "checkbox_background_focus_dark": "*checkbox_background", "checkbox_background_hover": "*color_background_primary", "checkbox_background_hover_dark": "*checkbox_background", "checkbox_background_selected": "*secondary_600", "checkbox_background_selected_dark": "#ff79c6", "checkbox_border_color": "*neutral_300", "checkbox_border_color_dark": "*neutral_700", "checkbox_border_color_focus": "*secondary_500", "checkbox_border_color_focus_dark": "*secondary_500", "checkbox_border_color_hover": "*neutral_300", "checkbox_border_color_hover_dark": "*neutral_600", "checkbox_border_color_selected": "*secondary_600", "checkbox_border_color_selected_dark": "*secondary_600", "checkbox_border_radius": "*radius_sm", "checkbox_border_width": "*input_border_width", "checkbox_label_background": "*neutral_200", "checkbox_label_background_dark": "*neutral_600", "checkbox_label_background_hover": "*checkbox_label_background", "checkbox_label_background_hover_dark": "*checkbox_label_background", "checkbox_label_background_selected": "*checkbox_label_background", "checkbox_label_background_selected_dark": "*checkbox_label_background", "checkbox_label_border_color": "*color_border_primary", "checkbox_label_border_color_dark": "*color_border_primary", "checkbox_label_border_color_hover": "*color_border_primary", "checkbox_label_border_color_hover_dark": "*color_border_primary", "checkbox_label_border_width": "*input_border_width", "checkbox_label_gap": "*spacing_lg", "checkbox_label_padding": "*spacing_md calc(2 * *spacing_md)", "checkbox_label_shadow": "none", "checkbox_label_text_size": "*text_md", "checkbox_label_text_weight": "400", "checkbox_shadow": "*input_shadow", "checkbox_text_color": "*body_text_color", "checkbox_text_color_dark": "*body_text_color", "checkbox_text_color_selected": "*checkbox_text_color", "checkbox_text_color_selected_dark": "*checkbox_text_color", "color_accent": "*primary_500", "color_accent_soft": "*primary_50", "color_accent_soft_dark": "*neutral_700", "color_background_primary": "white", "color_background_primary_dark": "*neutral_950", "color_background_secondary": "*neutral_50", "color_background_secondary_dark": "*neutral_900", "color_border_accent": "*primary_300", "color_border_accent_dark": "*neutral_600", "color_border_primary": "*neutral_200", "color_border_primary_dark": "*neutral_700", "container_radius": "*radius_lg", "embed_radius": "*radius_lg", "error_background": "#fee2e2", "error_background_dark": "*color_background_primary", "error_border_color": "#fecaca", "error_border_color_dark": "*color_border_primary", "error_border_width": "1px", "error_border_width_dark": "*error_border_width", "error_color": "#ef4444", "error_color_dark": "#ef4444", "form_gap_width": "0px", "header_text_weight": "600", "input_background": "*neutral_100", "input_background_dark": "*neutral_700", "input_background_focus": "*secondary_500", "input_background_focus_dark": "*secondary_600", "input_background_hover": "*input_background", "input_background_hover_dark": "*input_background", "input_border_color": "*color_border_primary", "input_border_color_dark": "*color_border_primary", "input_border_color_focus": "*secondary_300", "input_border_color_focus_dark": "*neutral_700", "input_border_color_hover": "*color_border_primary", "input_border_color_hover_dark": "*color_border_primary", "input_border_width": "0px", "input_padding": "*spacing_xl", "input_placeholder_color": "*neutral_400", "input_placeholder_color_dark": "*neutral_500", "input_radius": "*radius_lg", "input_shadow": "none", "input_shadow_dark": "*input_shadow", "input_shadow_focus": "*input_shadow", "input_shadow_focus_dark": "*input_shadow", "input_text_size": "*text_md", "input_text_weight": "400", "layout_gap": "*spacing_xxl", "loader_color": "*color_accent", "loader_color_dark": "*color_accent", "neutral_100": "#919cbf", "neutral_200": "#818eb6", "neutral_300": "#7280ad", "neutral_400": "#6272a4", "neutral_50": "#a1aac8", "neutral_500": "#586794", "neutral_600": "#4e5b83", "neutral_700": "#455073", "neutral_800": "#3b4462", "neutral_900": "#313952", "neutral_950": "#272e42", "panel_background": "*color_background_secondary", "panel_background_dark": "*color_background_secondary", "panel_border_color": "*color_border_primary", "panel_border_color_dark": "*color_border_primary", "panel_border_width": "0", "primary_100": "#fce7f3", "primary_200": "#fbcfe8", "primary_300": "#f9a8d4", "primary_400": "#f472b6", "primary_50": "#fdf2f8", "primary_500": "#ec4899", "primary_600": "#db2777", "primary_700": "#be185d", "primary_800": "#9d174d", "primary_900": "#831843", "primary_950": "#6e1a3d", "prose_text_size": "*text_md", "prose_text_weight": "400", "radius_lg": "8px", "radius_md": "6px", "radius_sm": "4px", "radius_xl": "12px", "radius_xs": "2px", "radius_xxl": "22px", "radius_xxs": "1px", "secondary_100": "#dbeafe", "secondary_200": "#bfdbfe", "secondary_300": "#93c5fd", "secondary_400": "#60a5fa", "secondary_50": "#eff6ff", "secondary_500": "#3b82f6", "secondary_600": "#2563eb", "secondary_700": "#1d4ed8", "secondary_800": "#1e40af", "secondary_900": "#1e3a8a", "secondary_950": "#1d3660", "section_text_size": "*text_md", "section_text_weight": "400", "shadow_drop": "rgba(0,0,0,0.05) 0px 1px 2px 0px", "shadow_drop_lg": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)", "shadow_inset": "rgba(0,0,0,0.05) 0px 2px 4px 0px inset", "shadow_spread": "3px", "shadow_spread_dark": "1px", "slider_color_dark": "#ff79c6", "spacing_lg": "8px", "spacing_md": "6px", "spacing_sm": "4px", "spacing_xl": "10px", "spacing_xs": "2px", "spacing_xxl": "16px", "spacing_xxs": "1px", "stat_color_background": "*primary_300", "stat_color_background_dark": "*primary_500", "table_border_color": "*neutral_300", "table_border_color_dark": "*neutral_700", "table_even_background": "white", "table_even_background_dark": "*neutral_950", "table_odd_background": "*neutral_50", "table_odd_background_dark": "*neutral_900", "table_radius": "*radius_lg", "table_row_focus": "*color_accent_soft", "table_row_focus_dark": "*color_accent_soft", "text_color_code_background": "*neutral_200", "text_color_code_background_dark": "*neutral_800", "text_color_code_border": "*color_border_primary", "text_color_link": "*secondary_600", "text_color_link_active": "*secondary_600", "text_color_link_active_dark": "*secondary_500", "text_color_link_dark": "*secondary_500", "text_color_link_hover": "*secondary_700", "text_color_link_hover_dark": "*secondary_400", "text_color_link_visited": "*secondary_500", "text_color_link_visited_dark": "*secondary_600", "text_color_subdued": "*neutral_400", "text_color_subdued_dark": "*neutral_400", "text_lg": "16px", "text_md": "14px", "text_sm": "12px", "text_xl": "22px", "text_xs": "10px", "text_xxl": "26px", "text_xxs": "9px"}, "version": "0.1.1"}