diff options
author | catboxanon <122327233+catboxanon@users.noreply.github.com> | 2023-05-12 18:08:34 +0000 |
---|---|---|
committer | catboxanon <122327233+catboxanon@users.noreply.github.com> | 2023-05-12 18:08:34 +0000 |
commit | 867be74244dc725fcf2685018b97501e83a16235 (patch) | |
tree | ff52a7fe5f57d677eb26f2e04216844ca54f4e38 /modules/shared.py | |
parent | b14e23529f52f926a8912b2c3d10b9a90dae3967 (diff) | |
download | stable-diffusion-webui-gfx803-867be74244dc725fcf2685018b97501e83a16235.tar.gz stable-diffusion-webui-gfx803-867be74244dc725fcf2685018b97501e83a16235.tar.bz2 stable-diffusion-webui-gfx803-867be74244dc725fcf2685018b97501e83a16235.zip |
Define default fonts for Gradio theme
Allows web UI to (almost) be ran fully offline.
The web UI will hang on load if offline when
these fonts are not manually defined, as it will attempt (and fail)
to pull from Google Fonts.
Diffstat (limited to 'modules/shared.py')
-rw-r--r-- | modules/shared.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/shared.py b/modules/shared.py index 1df1dd45..b09b384e 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -666,13 +666,19 @@ def reload_gradio_theme(theme_name=None): theme_name = opts.gradio_theme
if theme_name == "Default":
- gradio_theme = gr.themes.Default()
+ gradio_theme = gr.themes.Default(
+ font=['Helvetica', 'ui-sans-serif', 'system-ui', 'sans-serif'],
+ font_mono=['IBM Plex Mono', 'ui-monospace', 'Consolas', 'monospace'],
+ )
else:
try:
gradio_theme = gr.themes.ThemeClass.from_hub(theme_name)
except Exception as e:
errors.display(e, "changing gradio theme")
- gradio_theme = gr.themes.Default()
+ gradio_theme = gr.themes.Default(
+ font=['Helvetica', 'ui-sans-serif', 'system-ui', 'sans-serif'],
+ font_mono=['IBM Plex Mono', 'ui-monospace', 'Consolas', 'monospace'],
+ )
|