Spaces:
Running
Running
Round 2: Pro-DAW (Stems, Metronom, Marker/Loop, Fades, Master-LUFS, Automation, Recording, Autosave)
580f0af verified Download studio/theme.py from 2Btainment/2b-studio: direct link, hf CLI and curl.
- Browser
- Download file 6.73 kB
-
https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/studio/theme.py
- Command line
-
hf download hf://spaces/2Btainment/2b-studio/studio/theme.py
-
curl -L -o theme.py https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/studio/theme.py
6.73 kB
| """Toxic-Studio-Theme für 2B Studio (by EINswarm). | |
| Liefert THEME (Gradio-Theme), CSS (aus web/studio.css) und HEAD (Preloads + | |
| web/studio.js). Hell- und Dunkelmodus erhalten bewusst identische Werte, | |
| damit ein heller Browser-Modus die Oberfläche nicht mehr verfälscht. | |
| """ | |
| from __future__ import annotations | |
| from pathlib import Path | |
| import gradio as gr | |
| WEB_DIR = Path(__file__).resolve().parent / "web" | |
| STATIC_DIR = Path(__file__).resolve().parents[1] / "static" | |
| STATIC_URL = "/gradio_api/file=static" | |
| ACID = "#d4af37" | |
| ACID_HOVER = "#e2c25a" | |
| ON_ACID = "#140f02" | |
| INK = "#070707" | |
| PANEL = "rgba(17, 17, 17, .86)" | |
| FIELD = "rgba(6, 8, 5, .72)" | |
| LINE = "rgba(212, 175, 55, .16)" | |
| TEXT = "#f2eee6" | |
| MUTED = "#c2b9a8" | |
| _VARS: dict[str, str] = { | |
| "body_background_fill": INK, | |
| "body_text_color": TEXT, | |
| "body_text_color_subdued": MUTED, | |
| "background_fill_primary": "#0d0c0b", | |
| "background_fill_secondary": "#12110e", | |
| "border_color_primary": LINE, | |
| "border_color_accent": "rgba(212, 175, 55, .55)", | |
| "border_color_accent_subdued": "rgba(212, 175, 55, .3)", | |
| "color_accent": ACID, | |
| "color_accent_soft": "rgba(212, 175, 55, .14)", | |
| "block_background_fill": PANEL, | |
| "block_border_color": LINE, | |
| "block_border_width": "1px", | |
| "block_label_background_fill": "rgba(212, 175, 55, .1)", | |
| "block_label_border_color": "rgba(212, 175, 55, .22)", | |
| "block_label_text_color": "#efe2c4", | |
| "block_title_text_color": TEXT, | |
| "block_info_text_color": MUTED, | |
| "block_shadow": "none", | |
| "block_radius": "12px", | |
| "panel_background_fill": PANEL, | |
| "panel_border_color": LINE, | |
| "input_background_fill": FIELD, | |
| "input_background_fill_focus": "rgba(10, 14, 6, .9)", | |
| "input_background_fill_hover": FIELD, | |
| "input_border_color": "rgba(212, 175, 55, .2)", | |
| "input_border_color_focus": ACID, | |
| "input_border_color_hover": "rgba(212, 175, 55, .38)", | |
| "input_placeholder_color": "#958c7c", | |
| "input_shadow_focus": "0 0 0 3px rgba(212, 175, 55, .18)", | |
| "input_radius": "8px", | |
| "button_primary_background_fill": f"linear-gradient(135deg, #f0d68a 0%, {ACID} 45%, #b08a26 100%)", | |
| "button_primary_background_fill_hover": f"linear-gradient(135deg, #f7e7b4 0%, {ACID_HOVER} 45%, {ACID} 100%)", | |
| "button_primary_text_color": ON_ACID, | |
| "button_primary_text_color_hover": ON_ACID, | |
| "button_primary_border_color": ACID, | |
| "button_primary_border_color_hover": "#f0d68a", | |
| "button_primary_shadow": "0 0 24px -6px rgba(212, 175, 55, .55)", | |
| "button_primary_shadow_hover": "0 0 34px -4px rgba(212, 175, 55, .75)", | |
| "button_secondary_background_fill": "rgba(212, 175, 55, .06)", | |
| "button_secondary_background_fill_hover": "rgba(212, 175, 55, .14)", | |
| "button_secondary_text_color": "#f3e8cc", | |
| "button_secondary_text_color_hover": "#ffffff", | |
| "button_secondary_border_color": "rgba(212, 175, 55, .26)", | |
| "button_secondary_border_color_hover": "rgba(212, 175, 55, .6)", | |
| "button_cancel_background_fill": "rgba(255, 107, 138, .12)", | |
| "button_cancel_background_fill_hover": "rgba(255, 107, 138, .22)", | |
| "button_cancel_border_color": "rgba(255, 107, 138, .45)", | |
| "button_cancel_text_color": "#ffd5de", | |
| "button_large_radius": "6px", | |
| "button_medium_radius": "6px", | |
| "button_small_radius": "5px", | |
| "checkbox_background_color": FIELD, | |
| "checkbox_background_color_selected": ACID, | |
| "checkbox_border_color": "rgba(212, 175, 55, .4)", | |
| "checkbox_border_color_selected": ACID, | |
| "checkbox_label_background_fill": "rgba(212, 175, 55, .05)", | |
| "checkbox_label_background_fill_hover": "rgba(212, 175, 55, .1)", | |
| "checkbox_label_background_fill_selected": "rgba(212, 175, 55, .16)", | |
| "checkbox_label_border_color": "rgba(212, 175, 55, .18)", | |
| "checkbox_label_border_color_selected": ACID, | |
| "checkbox_label_text_color": "#f3e8cc", | |
| "checkbox_label_text_color_selected": "#ffffff", | |
| "slider_color": ACID, | |
| "loader_color": ACID, | |
| "link_text_color": ACID, | |
| "link_text_color_hover": "#f0d68a", | |
| "link_text_color_visited": "#c9a227", | |
| "code_background_fill": "rgba(212, 175, 55, .08)", | |
| "stat_background_fill": "rgba(212, 175, 55, .25)", | |
| "table_even_background_fill": "#0e110b", | |
| "table_odd_background_fill": "#12160e", | |
| "table_border_color": LINE, | |
| "error_background_fill": "rgba(255, 107, 138, .12)", | |
| "error_border_color": "rgba(255, 107, 138, .5)", | |
| "error_text_color": "#ffd5de", | |
| "shadow_drop": "0 10px 30px -12px rgba(0, 0, 0, .8)", | |
| "shadow_drop_lg": "0 20px 50px -18px rgba(0, 0, 0, .9)", | |
| "container_radius": "12px", | |
| } | |
| def build_theme() -> gr.themes.Base: | |
| theme = gr.themes.Base( | |
| primary_hue=gr.themes.colors.amber, | |
| secondary_hue=gr.themes.colors.amber, | |
| neutral_hue=gr.themes.colors.stone, | |
| # Font-Objekte statt Strings: Gradio vergleicht Themes beim launch() (Analytics) per Font.__eq__ | |
| font=[gr.themes.Font("Manrope"), gr.themes.Font("Segoe UI"), gr.themes.Font("sans-serif")], | |
| font_mono=[gr.themes.Font("JetBrains Mono"), gr.themes.Font("monospace")], | |
| radius_size=gr.themes.sizes.radius_md, | |
| ) | |
| valid = set(vars(theme)) | |
| values = {k: v for k, v in _VARS.items() if k in valid} | |
| values.update({f"{k}_dark": v for k, v in values.items() if f"{k}_dark" in valid}) | |
| return theme.set(**values) | |
| def _read(name: str) -> str: | |
| return (WEB_DIR / name).read_text(encoding="utf-8") | |
| def build_css() -> str: | |
| return _read("studio.css").replace("__STATIC__", STATIC_URL) | |
| def _ver() -> str: | |
| import hashlib | |
| h = hashlib.sha1() | |
| for name in ("daw.js", "daw.css"): | |
| f = STATIC_DIR / "daw" / name | |
| if f.exists(): | |
| h.update(f.read_bytes()) | |
| return h.hexdigest()[:10] | |
| def build_head() -> str: | |
| fonts = ("SairaStencilOne-400-latin", "ChakraPetch-600-latin", "Manrope-normal-latin") | |
| preload = "".join( | |
| f'<link rel="preload" href="{STATIC_URL}/fonts/{f}.woff2" as="font" type="font/woff2" crossorigin>' | |
| for f in fonts | |
| ) | |
| return ( | |
| '<meta name="theme-color" content="#070707">' | |
| '<meta name="color-scheme" content="dark">' | |
| '<meta name="description" content="2B Studio – KI-Musikstudio: generieren, hören, mastern. by EINswarm">' | |
| f'<link rel="icon" type="image/svg+xml" href="{STATIC_URL}/img/favicon.svg">' | |
| f"{preload}<script>{_read('studio.js')}</script>" | |
| f"<script>{(STATIC_DIR / 'daw' / 'avatar-guard.js').read_text(encoding='utf-8')}</script>" | |
| f'<link rel="stylesheet" href="{STATIC_URL}/daw/daw.css?v={_ver()}">' | |
| f'<script defer src="{STATIC_URL}/daw/daw.js?v={_ver()}"></script>' | |
| ) | |
| THEME = build_theme() | |
| CSS = build_css() | |
| HEAD = build_head() | |