mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
8d0d4e0a8e
* Customize scripts/generate_theme.py to reuse for the CSS generation for @gradio/lite * Build theme.css at the build time of Gradio-lite and update the frontend app to load it at the initialization phase * Add changeset --------- Co-authored-by: pngwn <hello@pngwn.io>
13 lines
525 B
Python
13 lines
525 B
Python
import argparse
|
|
from gradio import themes
|
|
|
|
parser = argparse.ArgumentParser(description='Generate themed CSS which is normally served from the /theme.css endpoint of a Gradio server.')
|
|
parser.add_argument('--outfile', type=argparse.FileType('w', encoding='latin-1'), default="-")
|
|
parser.add_argument('--theme', choices=["default", "glass", "monochrome", "soft"], default="default")
|
|
args = parser.parse_args()
|
|
|
|
ThemeClass = getattr(themes, args.theme.capitalize())
|
|
css = ThemeClass()._get_theme_css()
|
|
|
|
args.outfile.write(css)
|