Spaces:
Running on Zero
Running on Zero
File size: 2,528 Bytes
3c47e57 bc415db 3c47e57 bc415db 3c47e57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Gradio theme shared by the Spaces in this folder.
Canonical copy: shared-ui/brand_theme.py. Edit it there, then run
`python shared-ui/sync.py` to copy it into each project.
The start page uses the workspace's midnight palette in both browser modes, so
the plain keys and the `*_dark` keys hold the same values. The workspace's mint
panel sets its own colours (see brand.css).
"""
import gradio as gr
DARK = {
"body_background_fill": "#080f18", "body_text_color": "#eef3f5",
"body_text_color_subdued": "#a8bdc4", "background_fill_primary": "#091622",
"background_fill_secondary": "#112530", "block_background_fill": "#091622",
"block_border_color": "#577f89", "block_label_background_fill": "#091622",
"block_label_text_color": "#eef3f5", "block_title_background_fill": "transparent",
"block_title_text_color": "#eef3f5", "block_info_text_color": "#a8bdc4",
"panel_background_fill": "#091622", "input_background_fill": "#112530",
"input_background_fill_hover": "#193442", "input_background_fill_focus": "#112530",
"input_border_color": "#577f89", "input_placeholder_color": "#a8bdc4",
"accordion_text_color": "#eef3f5", "border_color_primary": "#577f89",
"button_secondary_background_fill": "#193442", "button_secondary_background_fill_hover": "#577f89",
"button_secondary_text_color": "#eef3f5", "button_secondary_text_color_hover": "#ffffff",
"link_text_color": "#f4bf67", "link_text_color_hover": "#f8d49a",
}
# Same system font stack as brand.css (--brand-sans) and Token Visualiser's Streamlit theme.
FONT = ["system-ui", "-apple-system", "Segoe UI", "Roboto", "sans-serif"]
# Amber primary actions and plain bordered inputs (as in Token Visualiser) in both modes.
PRIMARY = {
"input_border_width": "1px", "input_shadow": "none",
"input_shadow_focus": "0 0 0 2px #f4bf6733", "input_border_color_focus": "#f4bf67",
"button_primary_background_fill": "#f4bf67", "button_primary_background_fill_hover": "#e7aa45",
"button_primary_text_color": "#17242b", "button_primary_text_color_hover": "#17242b",
"button_primary_border_color": "#f4bf67", "button_primary_border_color_hover": "#e7aa45",
}
# Settings Gradio applies to both modes at once (no *_dark variant).
BOTH_MODES = {"input_radius": "10px"}
def brand_theme():
values = {**DARK, **PRIMARY, **BOTH_MODES}
values.update({key + "_dark": value for key, value in {**DARK, **PRIMARY}.items()})
return gr.themes.Soft(primary_hue="amber", neutral_hue="stone", font=FONT).set(**values)
|