mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
UI: improve the style of code blocks in light theme
This commit is contained in:
parent
9b205f94a4
commit
916d1d8283
10
css/highlightjs/github.min.css
vendored
Normal file
10
css/highlightjs/github.min.css
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
|
||||||
|
Theme: GitHub
|
||||||
|
Description: Light theme as seen on github.com
|
||||||
|
Author: github.com
|
||||||
|
Maintainer: @Hirse
|
||||||
|
Updated: 2021-05-15
|
||||||
|
|
||||||
|
Outdated base version: https://github.com/primer/github-syntax-light
|
||||||
|
Current colors taken from GitHub's CSS
|
||||||
|
*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}
|
@ -451,6 +451,11 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
font-size: 82%;
|
font-size: 82%;
|
||||||
padding: 1px 3px;
|
padding: 1px 3px;
|
||||||
|
background: white !important;
|
||||||
|
color: #1f2328;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .message-body code {
|
||||||
background: #0d1117 !important;
|
background: #0d1117 !important;
|
||||||
color: rgb(201 209 217);
|
color: rgb(201 209 217);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import io
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from modules import shared
|
||||||
from modules.logging_colors import logger
|
from modules.logging_colors import logger
|
||||||
|
|
||||||
original_open = open
|
original_open = open
|
||||||
@ -54,6 +55,7 @@ def my_open(*args, **kwargs):
|
|||||||
'\n <script src="file/js/katex/auto-render.min.js"></script>'
|
'\n <script src="file/js/katex/auto-render.min.js"></script>'
|
||||||
'\n <script src="file/js/highlightjs/highlight.min.js"></script>'
|
'\n <script src="file/js/highlightjs/highlight.min.js"></script>'
|
||||||
'\n <script src="file/js/highlightjs/highlightjs-copy.min.js"></script>'
|
'\n <script src="file/js/highlightjs/highlightjs-copy.min.js"></script>'
|
||||||
|
f'\n <link id="highlight-css" rel="stylesheet" href="file/css/highlightjs/{"github-dark" if shared.settings["dark_theme"] else "github"}.min.css">'
|
||||||
'\n <script>hljs.addPlugin(new CopyButtonPlugin());</script>'
|
'\n <script>hljs.addPlugin(new CopyButtonPlugin());</script>'
|
||||||
'\n </head>'
|
'\n </head>'
|
||||||
)
|
)
|
||||||
|
@ -15,8 +15,6 @@ with open(Path(__file__).resolve().parent / '../css/main.css', 'r') as f:
|
|||||||
css += f.read()
|
css += f.read()
|
||||||
with open(Path(__file__).resolve().parent / '../css/katex/katex.min.css', 'r') as f:
|
with open(Path(__file__).resolve().parent / '../css/katex/katex.min.css', 'r') as f:
|
||||||
css += f.read()
|
css += f.read()
|
||||||
with open(Path(__file__).resolve().parent / '../css/highlightjs/github-dark.min.css', 'r') as f:
|
|
||||||
css += f.read()
|
|
||||||
with open(Path(__file__).resolve().parent / '../css/highlightjs/highlightjs-copy.min.css', 'r') as f:
|
with open(Path(__file__).resolve().parent / '../css/highlightjs/highlightjs-copy.min.css', 'r') as f:
|
||||||
css += f.read()
|
css += f.read()
|
||||||
with open(Path(__file__).resolve().parent / '../js/main.js', 'r') as f:
|
with open(Path(__file__).resolve().parent / '../js/main.js', 'r') as f:
|
||||||
@ -29,6 +27,8 @@ with open(Path(__file__).resolve().parent / '../js/show_controls.js', 'r') as f:
|
|||||||
show_controls_js = f.read()
|
show_controls_js = f.read()
|
||||||
with open(Path(__file__).resolve().parent / '../js/update_big_picture.js', 'r') as f:
|
with open(Path(__file__).resolve().parent / '../js/update_big_picture.js', 'r') as f:
|
||||||
update_big_picture_js = f.read()
|
update_big_picture_js = f.read()
|
||||||
|
with open(Path(__file__).resolve().parent / '../js/dark_theme.js', 'r') as f:
|
||||||
|
dark_theme_js = f.read()
|
||||||
|
|
||||||
refresh_symbol = '🔄'
|
refresh_symbol = '🔄'
|
||||||
delete_symbol = '🗑️'
|
delete_symbol = '🗑️'
|
||||||
|
@ -36,7 +36,7 @@ def create_ui():
|
|||||||
|
|
||||||
shared.gradio['toggle_dark_mode'].click(
|
shared.gradio['toggle_dark_mode'].click(
|
||||||
lambda x: 'dark' if x == 'light' else 'light', gradio('theme_state'), gradio('theme_state')).then(
|
lambda x: 'dark' if x == 'light' else 'light', gradio('theme_state'), gradio('theme_state')).then(
|
||||||
None, None, None, js='() => {document.getElementsByTagName("body")[0].classList.toggle("dark")}')
|
None, None, None, js=f'() => {{{ui.dark_theme_js}; toggleDarkMode()}}')
|
||||||
|
|
||||||
shared.gradio['save_settings'].click(
|
shared.gradio['save_settings'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
|
Loading…
Reference in New Issue
Block a user