gradio/scripts/generate_theme.py
Yuichiro Tachibana (Tsuchiya) 8d0d4e0a8e
Prebuild lite css (#4788)
* 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>
2023-07-06 11:38:15 +01:00

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)