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
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -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,

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

View file

@ -1,4 +1,5 @@
{
"dark_theme": false,
"autoload_model": true,
"max_new_tokens": 200,
"max_new_tokens_min": 1,