deepkyu commited on
Commit
10f38d9
0 Parent(s):

initial commit

Browse files
Files changed (8) hide show
  1. .gitattributes +35 -0
  2. .gitignore +1 -0
  3. README.md +13 -0
  4. app.py +152 -0
  5. dev.py +154 -0
  6. main.css +47 -0
  7. themes/theme_schema@0.0.1.json +337 -0
  8. utils.py +10 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.sh
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - gradio-theme
4
+ title: theme-v4
5
+ colorFrom: gray
6
+ colorTo: gray
7
+ emoji: 🏞️
8
+ sdk: gradio
9
+ sdk_version: 4.13.0
10
+ app_file: app.py
11
+ pinned: false
12
+ license: apache-2.0
13
+ ---
app.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+
3
+ import gradio as gr
4
+ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
5
+
6
+ from utils import get_snippet_from_url
7
+
8
+ dropdown, js = create_theme_dropdown()
9
+
10
+ with gr.Blocks(
11
+ theme='nota-ai/theme-v4',
12
+ css=get_snippet_from_url("https://huggingface.co/spaces/nota-ai/theme-v4/raw/main/main.css")
13
+ ) as demo:
14
+ with gr.Row(equal_height=True):
15
+ with gr.Column(scale=10):
16
+ gr.Markdown(
17
+ """
18
+ # Theme preview: `theme-v4`
19
+ To use this theme, set `theme='nota-ai/theme-v4'` in `gr.Blocks()` or `gr.Interface()`.
20
+ You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
21
+ of this theme.
22
+ """
23
+ )
24
+ with gr.Column(scale=3):
25
+ with gr.Group():
26
+ dropdown.render()
27
+ toggle_dark = gr.Button(value="Toggle Dark")
28
+
29
+ dropdown.change(None, dropdown, None, js=js)
30
+ toggle_dark.click(
31
+ None,
32
+ js="""
33
+ () => {
34
+ document.body.classList.toggle('dark');
35
+ }
36
+ """,
37
+ )
38
+
39
+ name = gr.Textbox(
40
+ label="Name",
41
+ info="Full name, including middle name. No special characters.",
42
+ placeholder="John Doe",
43
+ value="John Doe",
44
+ interactive=True,
45
+ )
46
+
47
+ with gr.Row():
48
+ slider1 = gr.Slider(label="Slider 1")
49
+ slider2 = gr.Slider(label="Slider 2")
50
+ gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
51
+
52
+ with gr.Row():
53
+ with gr.Column(variant="panel", scale=1):
54
+ gr.Markdown("## Panel 1")
55
+ radio = gr.Radio(
56
+ ["A", "B", "C"],
57
+ label="Radio",
58
+ info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
59
+ )
60
+ drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
61
+ drop_2 = gr.Dropdown(
62
+ ["Option A", "Option B", "Option C"],
63
+ multiselect=True,
64
+ value=["Option A"],
65
+ label="Dropdown",
66
+ interactive=True,
67
+ )
68
+ check = gr.Checkbox(label="Go")
69
+ with gr.Column(variant="panel", scale=2):
70
+ img = gr.Image(
71
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
72
+ label="Image",
73
+ height=320,
74
+ )
75
+ with gr.Row():
76
+ go_btn = gr.Button("Go", variant="primary")
77
+ clear_btn = gr.Button("Clear", variant="secondary")
78
+
79
+ def go(*args):
80
+ time.sleep(3)
81
+ return "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpgjpg"
82
+
83
+ go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
84
+
85
+ def clear():
86
+ time.sleep(0.2)
87
+ return None
88
+
89
+ clear_btn.click(clear, None, img)
90
+
91
+ with gr.Row():
92
+ btn1 = gr.Button("Button 1", size="sm")
93
+ btn2 = gr.UploadButton(size="sm")
94
+ stop_btn = gr.Button("Stop", size="sm", variant="stop")
95
+
96
+ with gr.Row():
97
+ gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
98
+ gr.JSON(
99
+ value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
100
+ )
101
+ gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
102
+ gr.File()
103
+ with gr.Row():
104
+ gr.ColorPicker()
105
+ gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
106
+ gr.Gallery(
107
+ [
108
+ (
109
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
110
+ "lion",
111
+ ),
112
+ (
113
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
114
+ "logo",
115
+ ),
116
+ (
117
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
118
+ "tower",
119
+ ),
120
+ ],
121
+ height=200,
122
+ )
123
+
124
+ with gr.Row():
125
+ with gr.Column(scale=2):
126
+ chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
127
+ chat_btn = gr.Button("Add messages")
128
+
129
+ def chat(history):
130
+ time.sleep(2)
131
+ yield [["How are you?", "I am good."]]
132
+
133
+ chat_btn.click(
134
+ lambda history: history
135
+ + [["How are you?", "I am good."]]
136
+ + (time.sleep(2) or []),
137
+ chatbot,
138
+ chatbot,
139
+ )
140
+ with gr.Column(scale=1):
141
+ with gr.Accordion("Advanced Settings"):
142
+ gr.Markdown("Hello")
143
+ gr.Number(label="Chatbot control 1")
144
+ gr.Number(label="Chatbot control 2")
145
+ gr.Number(label="Chatbot control 3")
146
+
147
+
148
+ if __name__ == "__main__":
149
+ demo.queue().launch()
150
+
151
+
152
+
dev.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+
3
+ import gradio as gr
4
+ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
5
+
6
+ from utils import get_snippet_from_file
7
+
8
+ dropdown, js = create_theme_dropdown()
9
+
10
+ theme_from_json = gr.themes.Base.load("themes/theme_schema@0.0.1.json")
11
+
12
+ with gr.Blocks(
13
+ theme=theme_from_json,
14
+ css=get_snippet_from_file("main.css")
15
+ ) as demo:
16
+ with gr.Row(equal_height=True):
17
+ with gr.Column(scale=10):
18
+ gr.Markdown(
19
+ """
20
+ # Theme preview: `theme-v4`
21
+ To use this theme, set `theme='nota-ai/theme-v4'` in `gr.Blocks()` or `gr.Interface()`.
22
+ You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
23
+ of this theme.
24
+ """
25
+ )
26
+ with gr.Column(scale=3):
27
+ with gr.Group():
28
+ dropdown.render()
29
+ toggle_dark = gr.Button(value="Toggle Dark")
30
+
31
+ dropdown.change(None, dropdown, None, js=js)
32
+ toggle_dark.click(
33
+ None,
34
+ js="""
35
+ () => {
36
+ document.body.classList.toggle('dark');
37
+ }
38
+ """,
39
+ )
40
+
41
+ name = gr.Textbox(
42
+ label="Name",
43
+ info="Full name, including middle name. No special characters.",
44
+ placeholder="John Doe",
45
+ value="John Doe",
46
+ interactive=True,
47
+ )
48
+
49
+ with gr.Row():
50
+ slider1 = gr.Slider(label="Slider 1")
51
+ slider2 = gr.Slider(label="Slider 2")
52
+ gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
53
+
54
+ with gr.Row():
55
+ with gr.Column(variant="panel", scale=1):
56
+ gr.Markdown("## Panel 1")
57
+ radio = gr.Radio(
58
+ ["A", "B", "C"],
59
+ label="Radio",
60
+ info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
61
+ )
62
+ drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
63
+ drop_2 = gr.Dropdown(
64
+ ["Option A", "Option B", "Option C"],
65
+ multiselect=True,
66
+ value=["Option A"],
67
+ label="Dropdown",
68
+ interactive=True,
69
+ )
70
+ check = gr.Checkbox(label="Go")
71
+ with gr.Column(variant="panel", scale=2):
72
+ img = gr.Image(
73
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
74
+ label="Image",
75
+ height=320,
76
+ )
77
+ with gr.Row():
78
+ go_btn = gr.Button("Go", variant="primary")
79
+ clear_btn = gr.Button("Clear", variant="secondary")
80
+
81
+ def go(*args):
82
+ time.sleep(3)
83
+ return "https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpgjpg"
84
+
85
+ go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
86
+
87
+ def clear():
88
+ time.sleep(0.2)
89
+ return None
90
+
91
+ clear_btn.click(clear, None, img)
92
+
93
+ with gr.Row():
94
+ btn1 = gr.Button("Button 1", size="sm")
95
+ btn2 = gr.UploadButton(size="sm")
96
+ stop_btn = gr.Button("Stop", size="sm", variant="stop")
97
+
98
+ with gr.Row():
99
+ gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
100
+ gr.JSON(
101
+ value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
102
+ )
103
+ gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
104
+ gr.File()
105
+ with gr.Row():
106
+ gr.ColorPicker()
107
+ gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
108
+ gr.Gallery(
109
+ [
110
+ (
111
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
112
+ "lion",
113
+ ),
114
+ (
115
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
116
+ "logo",
117
+ ),
118
+ (
119
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
120
+ "tower",
121
+ ),
122
+ ],
123
+ height=200,
124
+ )
125
+
126
+ with gr.Row():
127
+ with gr.Column(scale=2):
128
+ chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
129
+ chat_btn = gr.Button("Add messages")
130
+
131
+ def chat(history):
132
+ time.sleep(2)
133
+ yield [["How are you?", "I am good."]]
134
+
135
+ chat_btn.click(
136
+ lambda history: history
137
+ + [["How are you?", "I am good."]]
138
+ + (time.sleep(2) or []),
139
+ chatbot,
140
+ chatbot,
141
+ )
142
+ with gr.Column(scale=1):
143
+ with gr.Accordion("Advanced Settings"):
144
+ gr.Markdown("Hello")
145
+ gr.Number(label="Chatbot control 1")
146
+ gr.Number(label="Chatbot control 2")
147
+ gr.Number(label="Chatbot control 3")
148
+
149
+
150
+ if __name__ == "__main__":
151
+ demo.queue().launch()
152
+
153
+
154
+
main.css ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Center-align the title */
2
+ h1, h2, h3 {
3
+ text-align: center;
4
+ display:block;
5
+ }
6
+
7
+
8
+ /* Hide sort buttons at gr.DataFrame */
9
+ .sort-button {
10
+ display: none !important;
11
+ }
12
+
13
+
14
+ /* Color fix at gr.Chatbot */
15
+ .user-row * {
16
+ background-color: var(--checkbox-label-background-fill) !important;
17
+ border-color: var(--primary-400) !important;
18
+ color: var(--checkbox-label-text-color) !important;
19
+ border-radius: 22px 22px 0 22px !important;
20
+ }
21
+
22
+ .bot-row * {
23
+ background-color: var(--checkbox-label-background-fill) !important;
24
+ border-color: var(--checkbox-label-border-color) !important;
25
+ color: var(--checkbox-label-text-color) !important;
26
+ border-radius: 22px 22px 22px 0 !important;
27
+ }
28
+
29
+ .pending * {
30
+ background-color: var(--checkbox-background-color) !important;
31
+ border-color: var(--checkbox-border-color) !important;
32
+ color: var(--checkbox-label-text-color) !important;
33
+ border-radius: 22px 22px 22px 0 !important;
34
+ }
35
+
36
+
37
+ /* Border fix for the code expression at gr.Markdown */
38
+ .md :not(pre) > code {
39
+ border-radius: 3px !important;
40
+ border: 0px !important;
41
+
42
+ }
43
+
44
+ /* Better visibility at gr.Slider */
45
+ input[type="range"] {
46
+ background-color: var(--checkbox-background-color) !important;
47
+ }
themes/theme_schema@0.0.1.json ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "theme": {
3
+ "_font": [
4
+ {
5
+ "__gradio_font__": true,
6
+ "name": "Gabarito",
7
+ "class": "google"
8
+ },
9
+ {
10
+ "__gradio_font__": true,
11
+ "name": "Roboto",
12
+ "class": "google"
13
+ },
14
+ {
15
+ "__gradio_font__": true,
16
+ "name": "system-ui",
17
+ "class": "font"
18
+ },
19
+ {
20
+ "__gradio_font__": true,
21
+ "name": "sans-system-ui",
22
+ "class": "font"
23
+ }
24
+ ],
25
+ "_font_mono": [
26
+ {
27
+ "__gradio_font__": true,
28
+ "name": "Roboto Mono",
29
+ "class": "google"
30
+ },
31
+ {
32
+ "__gradio_font__": true,
33
+ "name": "ui-monospace",
34
+ "class": "font"
35
+ },
36
+ {
37
+ "__gradio_font__": true,
38
+ "name": "Consolas",
39
+ "class": "font"
40
+ },
41
+ {
42
+ "__gradio_font__": true,
43
+ "name": "monospace",
44
+ "class": "font"
45
+ }
46
+ ],
47
+ "_stylesheets": [
48
+ "https://fonts.googleapis.com/css2?family=Gabarito:wght@400;600&display=swap",
49
+ "https://fonts.googleapis.com/css2?family=Roboto:wght@400;600&display=swap",
50
+ "https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;600&display=swap"
51
+ ],
52
+ "background_fill_primary": "white",
53
+ "background_fill_primary_dark": "black",
54
+ "background_fill_secondary": "white",
55
+ "background_fill_secondary_dark": "black",
56
+ "block_background_fill": "white",
57
+ "block_background_fill_dark": "black",
58
+ "block_border_color": "*neutral_200",
59
+ "block_border_color_dark": "*neutral_700",
60
+ "block_border_width": "1px",
61
+ "block_border_width_dark": "1px",
62
+ "block_info_text_color": "*body_text_color_subdued",
63
+ "block_info_text_color_dark": "*body_text_color_subdued",
64
+ "block_info_text_size": "*text_sm",
65
+ "block_info_text_weight": "400",
66
+ "block_label_background_fill": "white",
67
+ "block_label_background_fill_dark": "black",
68
+ "block_label_border_color": "none",
69
+ "block_label_border_color_dark": "none",
70
+ "block_label_border_width": "1px",
71
+ "block_label_margin": "0",
72
+ "block_label_padding": "*spacing_sm *spacing_lg",
73
+ "block_label_radius": "calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0",
74
+ "block_label_right_radius": "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)",
75
+ "block_label_shadow": "none",
76
+ "block_label_text_color": "black",
77
+ "block_label_text_color_dark": "white",
78
+ "block_label_text_size": "*text_sm",
79
+ "block_label_text_weight": "400",
80
+ "block_padding": "*spacing_xl calc(*spacing_xl + 2px)",
81
+ "block_radius": "*radius_lg",
82
+ "block_shadow": "none",
83
+ "block_title_background_fill": "none",
84
+ "block_title_border_color": "none",
85
+ "block_title_border_width": "0px",
86
+ "block_title_padding": "0",
87
+ "block_title_radius": "none",
88
+ "block_title_text_color": "black",
89
+ "block_title_text_color_dark": "white",
90
+ "block_title_text_size": "*text_md",
91
+ "block_title_text_weight": "400",
92
+ "body_background_fill": "*background_fill_primary",
93
+ "body_background_fill_dark": "*background_fill_primary",
94
+ "body_text_color": "black",
95
+ "body_text_color_dark": "white",
96
+ "body_text_color_subdued": "black",
97
+ "body_text_color_subdued_dark": "white",
98
+ "body_text_size": "*text_md",
99
+ "body_text_weight": "400",
100
+ "border_color_accent": "black",
101
+ "border_color_accent_dark": "white",
102
+ "border_color_accent_subdued": "black",
103
+ "border_color_accent_subdued_dark": "white",
104
+ "border_color_primary": "white",
105
+ "border_color_primary_dark": "black",
106
+ "button_border_width": "2px",
107
+ "button_border_width_dark": "2px",
108
+ "button_cancel_background_fill": "black",
109
+ "button_cancel_background_fill_dark": "white",
110
+ "button_cancel_background_fill_hover": "*button_cancel_background_fill",
111
+ "button_cancel_background_fill_hover_dark": "*button_cancel_background_fill",
112
+ "button_cancel_border_color": "none",
113
+ "button_cancel_border_color_dark": "none",
114
+ "button_cancel_border_color_hover": "none",
115
+ "button_cancel_border_color_hover_dark": "none",
116
+ "button_cancel_text_color": "white",
117
+ "button_cancel_text_color_dark": "black",
118
+ "button_cancel_text_color_hover": "*primary_400",
119
+ "button_cancel_text_color_hover_dark": "*primary_400",
120
+ "button_large_padding": "*spacing_lg calc(2 * *spacing_lg)",
121
+ "button_large_radius": "*radius_lg",
122
+ "button_large_text_size": "*text_lg",
123
+ "button_large_text_weight": "600",
124
+ "button_primary_background_fill": "*primary_400",
125
+ "button_primary_background_fill_dark": "*primary_400",
126
+ "button_primary_background_fill_hover": "*primary_500",
127
+ "button_primary_background_fill_hover_dark": "*primary_500",
128
+ "button_primary_border_color": "none",
129
+ "button_primary_border_color_dark": "none",
130
+ "button_primary_border_color_hover": "none",
131
+ "button_primary_border_color_hover_dark": "none",
132
+ "button_primary_text_color": "white",
133
+ "button_primary_text_color_dark": "white",
134
+ "button_primary_text_color_hover": "*button_primary_text_color",
135
+ "button_primary_text_color_hover_dark": "*button_primary_text_color",
136
+ "button_secondary_background_fill": "white",
137
+ "button_secondary_background_fill_dark": "black",
138
+ "button_secondary_background_fill_hover": "*button_secondary_background_fill",
139
+ "button_secondary_background_fill_hover_dark": "*button_secondary_background_fill",
140
+ "button_secondary_border_color": "black",
141
+ "button_secondary_border_color_dark": "white",
142
+ "button_secondary_border_color_hover": "*button_secondary_border_color",
143
+ "button_secondary_border_color_hover_dark": "*button_secondary_border_color",
144
+ "button_secondary_text_color": "black",
145
+ "button_secondary_text_color_dark": "white",
146
+ "button_secondary_text_color_hover": "*primary_400",
147
+ "button_secondary_text_color_hover_dark": "*primary_400",
148
+ "button_shadow": "none",
149
+ "button_shadow_active": "none",
150
+ "button_shadow_hover": "none",
151
+ "button_small_padding": "*spacing_sm calc(2 * *spacing_sm)",
152
+ "button_small_radius": "*radius_lg",
153
+ "button_small_text_size": "*text_md",
154
+ "button_small_text_weight": "400",
155
+ "button_transition": "none",
156
+ "checkbox_background_color": "*neutral_200",
157
+ "checkbox_background_color_dark": "*neutral_700",
158
+ "checkbox_background_color_focus": "*checkbox_background_color",
159
+ "checkbox_background_color_focus_dark": "*checkbox_background_color",
160
+ "checkbox_background_color_hover": "*neutral_700",
161
+ "checkbox_background_color_hover_dark": "*neutral_200",
162
+ "checkbox_background_color_selected": "*neutral_700",
163
+ "checkbox_background_color_selected_dark": "*neutral_200",
164
+ "checkbox_border_color": "none",
165
+ "checkbox_border_color_dark": "none",
166
+ "checkbox_border_color_focus": "*none",
167
+ "checkbox_border_color_focus_dark": "*none",
168
+ "checkbox_border_color_hover": "*none",
169
+ "checkbox_border_color_hover_dark": "*none",
170
+ "checkbox_border_color_selected": "*none",
171
+ "checkbox_border_color_selected_dark": "*none",
172
+ "checkbox_border_radius": "*radius_sm",
173
+ "checkbox_border_width": "*input_border_width",
174
+ "checkbox_border_width_dark": "*input_border_width",
175
+ "checkbox_check": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")",
176
+ "checkbox_label_background_fill": "white",
177
+ "checkbox_label_background_fill_dark": "black",
178
+ "checkbox_label_background_fill_hover": "*button_secondary_background_fill_hover",
179
+ "checkbox_label_background_fill_hover_dark": "*button_secondary_background_fill_hover",
180
+ "checkbox_label_background_fill_selected": "black",
181
+ "checkbox_label_background_fill_selected_dark": "white",
182
+ "checkbox_label_border_color": "black",
183
+ "checkbox_label_border_color_dark": "white",
184
+ "checkbox_label_border_color_hover": "*checkbox_label_border_color",
185
+ "checkbox_label_border_color_hover_dark": "*checkbox_label_border_color",
186
+ "checkbox_label_border_width": "*input_border_width",
187
+ "checkbox_label_border_width_dark": "*input_border_width",
188
+ "checkbox_label_gap": "*spacing_lg",
189
+ "checkbox_label_padding": "*spacing_md calc(2 * *spacing_md)",
190
+ "checkbox_label_shadow": "none",
191
+ "checkbox_label_text_color": "*body_text_color",
192
+ "checkbox_label_text_color_dark": "*body_text_color",
193
+ "checkbox_label_text_color_selected": "white",
194
+ "checkbox_label_text_color_selected_dark": "black",
195
+ "checkbox_label_text_size": "*text_md",
196
+ "checkbox_label_text_weight": "400",
197
+ "checkbox_shadow": "*input_shadow",
198
+ "code_background_fill": "*neutral_200",
199
+ "code_background_fill_dark": "*neutral_700",
200
+ "color_accent": "*primary_400",
201
+ "color_accent_soft": "black",
202
+ "color_accent_soft_dark": "white",
203
+ "container_radius": "*radius_lg",
204
+ "embed_radius": "*radius_lg",
205
+ "error_background_fill": "#fef2f2",
206
+ "error_background_fill_dark": "*background_fill_primary",
207
+ "error_border_color": "*neutral_200",
208
+ "error_border_color_dark": "*neutral_700",
209
+ "error_border_width": "1px",
210
+ "error_icon_color": "#b91c1c",
211
+ "error_icon_color_dark": "#ef4444",
212
+ "error_text_color": "#b91c1c",
213
+ "error_text_color_dark": "#fef2f2",
214
+ "font": "'Gabarito', 'Roboto', 'system-ui', 'sans-system-ui'",
215
+ "font_mono": "'Roboto Mono', 'ui-monospace', 'Consolas', monospace",
216
+ "form_gap_width": "0px",
217
+ "input_background_fill": "white",
218
+ "input_background_fill_dark": "black",
219
+ "input_background_fill_focus": "*neutral_200",
220
+ "input_background_fill_focus_dark": "*neutral_700",
221
+ "input_background_fill_hover": "*input_background_fill",
222
+ "input_background_fill_hover_dark": "*input_background_fill",
223
+ "input_border_color": "black",
224
+ "input_border_color_dark": "white",
225
+ "input_border_color_focus": "*neutral_200",
226
+ "input_border_color_focus_dark": "*neutral_700",
227
+ "input_border_color_hover": "*input_border_color",
228
+ "input_border_color_hover_dark": "*input_border_color",
229
+ "input_border_width": "1px",
230
+ "input_border_width_dark": "1px",
231
+ "input_padding": "*spacing_xl",
232
+ "input_placeholder_color": "*neutral_200",
233
+ "input_placeholder_color_dark": "*neutral_700",
234
+ "input_radius": "*radius_lg",
235
+ "input_shadow": "none",
236
+ "input_shadow_focus": "*input_shadow",
237
+ "input_text_size": "*text_md",
238
+ "input_text_weight": "400",
239
+ "layout_gap": "*spacing_xxl",
240
+ "link_text_color": "black",
241
+ "link_text_color_active": "*neutral_700",
242
+ "link_text_color_active_dark": "*neutral_200",
243
+ "link_text_color_dark": "white",
244
+ "link_text_color_hover": "*primary_400",
245
+ "link_text_color_hover_dark": "*primary_400",
246
+ "link_text_color_visited": "black",
247
+ "link_text_color_visited_dark": "white",
248
+ "loader_color": "black",
249
+ "loader_color_dark": "white",
250
+ "name": "base",
251
+ "neutral_50": "#fafafa",
252
+ "neutral_100": "#f5f5f5",
253
+ "neutral_200": "#e5e5e5",
254
+ "neutral_300": "#d4d4d4",
255
+ "neutral_400": "#a3a3a3",
256
+ "neutral_500": "#737373",
257
+ "neutral_600": "#525252",
258
+ "neutral_700": "#404040",
259
+ "neutral_800": "#262626",
260
+ "neutral_900": "#171717",
261
+ "neutral_950": "#0a0a0a",
262
+ "panel_background_fill": "*background_fill_secondary",
263
+ "panel_background_fill_dark": "*background_fill_secondary",
264
+ "panel_border_color": "black",
265
+ "panel_border_color_dark": "white",
266
+ "panel_border_width": "1px",
267
+ "panel_border_width_dark": "1px",
268
+ "primary_50": "#37373b",
269
+ "primary_100": "#37373b",
270
+ "primary_200": "#37373b",
271
+ "primary_300": "#37373b",
272
+ "primary_400": "#3264f0",
273
+ "primary_500": "#2d5ad8",
274
+ "primary_600": "#37373b",
275
+ "primary_700": "#37373b",
276
+ "primary_800": "#37373b",
277
+ "primary_900": "#37373b",
278
+ "primary_950": "#37373b",
279
+ "prose_header_text_weight": "600",
280
+ "prose_text_size": "*text_md",
281
+ "prose_text_weight": "400",
282
+ "radio_circle": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")",
283
+ "radius_lg": "0px",
284
+ "radius_md": "0px",
285
+ "radius_sm": "0px",
286
+ "radius_xl": "0px",
287
+ "radius_xs": "0px",
288
+ "radius_xxl": "0px",
289
+ "radius_xxs": "0px",
290
+ "secondary_50": "#fafafa",
291
+ "secondary_100": "#f5f5f5",
292
+ "secondary_200": "#e5e5e5",
293
+ "secondary_300": "#d4d4d4",
294
+ "secondary_400": "#a3a3a3",
295
+ "secondary_500": "#737373",
296
+ "secondary_600": "#525252",
297
+ "secondary_700": "#404040",
298
+ "secondary_800": "#262626",
299
+ "secondary_900": "#171717",
300
+ "secondary_950": "#0a0a0a",
301
+ "section_header_text_size": "*text_md",
302
+ "section_header_text_weight": "400",
303
+ "shadow_drop": "rgba(0,0,0,0.05) 0px 1px 2px 0px",
304
+ "shadow_drop_lg": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
305
+ "shadow_inset": "rgba(0,0,0,0.05) 0px 2px 4px 0px inset",
306
+ "shadow_spread": "3px",
307
+ "shadow_spread_dark": "1px",
308
+ "slider_color": "black",
309
+ "slider_color_dark": "white",
310
+ "spacing_lg": "8px",
311
+ "spacing_md": "6px",
312
+ "spacing_sm": "4px",
313
+ "spacing_xl": "10px",
314
+ "spacing_xs": "2px",
315
+ "spacing_xxl": "16px",
316
+ "spacing_xxs": "1px",
317
+ "stat_background_fill": "black",
318
+ "stat_background_fill_dark": "white",
319
+ "table_border_color": "black",
320
+ "table_border_color_dark": "white",
321
+ "table_even_background_fill": "*neutral_200",
322
+ "table_even_background_fill_dark": "*neutral_700",
323
+ "table_odd_background_fill": "*neutral_200",
324
+ "table_odd_background_fill_dark": "*neutral_700",
325
+ "table_radius": "*radius_lg",
326
+ "table_row_focus": "*color_accent_soft",
327
+ "table_row_focus_dark": "*color_accent_soft",
328
+ "text_lg": "16px",
329
+ "text_md": "14px",
330
+ "text_sm": "12px",
331
+ "text_xl": "22px",
332
+ "text_xs": "10px",
333
+ "text_xxl": "26px",
334
+ "text_xxs": "9px"
335
+ },
336
+ "version": "0.0.1"
337
+ }
utils.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from urllib import request
3
+
4
+ def get_snippet_from_url(url: str) -> str:
5
+ response = request.urlopen(url)
6
+ data = response.read().decode()
7
+ return data
8
+
9
+ def get_snippet_from_file(filepath: str) -> str:
10
+ return Path(filepath).read_text()