diff --git a/args_manager.py b/args_manager.py index 3c34d33..b5768ac 100644 --- a/args_manager.py +++ b/args_manager.py @@ -15,6 +15,8 @@ fcbh_cli.parser.add_argument("--enable-smart-memory", action="store_true", help="Force loading models to vram when the unload can be avoided. " "Some Mac users may need this.") +fcbh_cli.parser.add_argument("--theme", type=str, help="launches the UI with light or dark theme", default=None) + fcbh_cli.parser.set_defaults( disable_cuda_malloc=True, auto_launch=True, diff --git a/fooocus_version.py b/fooocus_version.py index 3812afa..5e43afa 100644 --- a/fooocus_version.py +++ b/fooocus_version.py @@ -1 +1 @@ -version = '2.1.816' +version = '2.1.817' diff --git a/javascript/script.js b/javascript/script.js index dc7f976..05a8c59 100644 --- a/javascript/script.js +++ b/javascript/script.js @@ -166,3 +166,10 @@ function uiElementInSight(el) { function playNotification() { gradioApp().querySelector('#audio_notification audio')?.play(); } + +function set_theme(theme) { + var gradioURL = window.location.href; + if (!gradioURL.includes('?__theme=')) { + window.location.replace(gradioURL + '?__theme=' + theme); + } +} diff --git a/modules/ui_gradio_extensions.py b/modules/ui_gradio_extensions.py index 0d0df97..cf9c792 100644 --- a/modules/ui_gradio_extensions.py +++ b/modules/ui_gradio_extensions.py @@ -38,6 +38,10 @@ def javascript_html(): head += f'\n' head += f'\n' head += f'\n' + + if args_manager.args.theme: + head += f'\n' + return head diff --git a/update_log.md b/update_log.md index a151adf..c322990 100644 --- a/update_log.md +++ b/update_log.md @@ -1,3 +1,7 @@ +# 2.1.817 + +* support "--theme dark" and "--theme light". + # 2.1.815 * Multiple loras in preset.