mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-03-17 19:04:39 +01:00
UI: Fix dark theme using light theme syntax highlighting
This commit is contained in:
parent
beab346f48
commit
c09a367c64
|
|
@ -2,6 +2,12 @@
|
|||
// Main
|
||||
// ------------------------------------------------
|
||||
|
||||
// Sync highlight.js theme with the actual Gradio theme
|
||||
var defined_hljs_css = document.body.classList.contains("dark") ? "file/css/highlightjs/github-dark.min.css" : "file/css/highlightjs/github.min.css";
|
||||
if (document.getElementById("highlight-css").getAttribute("href") !== defined_hljs_css) {
|
||||
document.getElementById("highlight-css").setAttribute("href", defined_hljs_css);
|
||||
}
|
||||
|
||||
let main_parent = document.getElementById("chat-tab").parentNode;
|
||||
let extensions = document.getElementById("extensions");
|
||||
|
||||
|
|
|
|||
|
|
@ -218,6 +218,10 @@ def create_interface():
|
|||
|
||||
shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False)
|
||||
|
||||
# Sync theme_state with the actual client-side theme so that
|
||||
# autosave always writes the correct dark_theme value.
|
||||
shared.gradio['interface'].load(None, None, gradio('theme_state'), js='() => document.body.classList.contains("dark") ? "dark" : "light"')
|
||||
|
||||
extensions_module.create_extensions_tabs() # Extensions tabs
|
||||
extensions_module.create_extensions_block() # Extensions block
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue