diff --git a/modules/shared.py b/modules/shared.py index 0b34d339..04197d3c 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -33,6 +33,7 @@ reload_inputs = [] # Parameters for reloading the chat interface need_restart = False settings = { + 'dark_theme': False, 'autoload_model': True, 'max_new_tokens': 200, 'max_new_tokens_min': 1, diff --git a/server.py b/server.py index df4ebe5e..f1705ab5 100644 --- a/server.py +++ b/server.py @@ -968,7 +968,11 @@ def create_interface(): shared.gradio['count_tokens'].click(count_tokens, shared.gradio['textbox'], shared.gradio['status'], show_progress=False) shared.gradio['interface'].load(lambda: None, None, None, _js=f"() => {{{js}}}") + if shared.settings['dark_theme']: + shared.gradio['interface'].load(lambda: None, None, None, _js=f"() => document.getElementsByTagName('body')[0].classList.add('dark')") + shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, [shared.gradio[k] for k in ui.list_interface_input_elements(chat=shared.is_chat())], show_progress=False) + # Extensions tabs extensions_module.create_extensions_tabs() diff --git a/settings-template.json b/settings-template.json index 2c405a5d..2c780351 100644 --- a/settings-template.json +++ b/settings-template.json @@ -1,4 +1,5 @@ { + "dark_theme": false, "autoload_model": true, "max_new_tokens": 200, "max_new_tokens_min": 1,