代码高亮开关

This commit is contained in:
Your Name 2023-04-08 00:41:39 +08:00
parent e371b82ea3
commit 476a174320
2 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,9 @@ else:
# 对话窗的高度
CHATBOT_HEIGHT = 1115
# 代码高亮
CODE_HIGHLIGHT = True
# 窗口布局
LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)

View File

@ -1,5 +1,6 @@
import gradio as gr
from toolbox import get_conf
CODE_HIGHLIGHT, = get_conf('CODE_HIGHLIGHT')
# gradio可用颜色列表
# gr.themes.utils.colors.slate (石板色)
# gr.themes.utils.colors.gray (灰色)
@ -155,7 +156,8 @@ advanced_css = """
}
"""
advanced_css += """
if CODE_HIGHLIGHT:
advanced_css += """
.hll { background-color: #ffffcc }
.c { color: #3D7B7B; font-style: italic } /* Comment */
.err { border: 1px solid #FF0000 } /* Error */