Add a "dark_theme" option to settings.json (#2288)

This commit is contained in:
Gabriel Terrien 2023-05-23 00:45:11 +02:00 committed by GitHub
parent c5446ae0e2
commit 0f51b64bb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -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()