diff --git a/config.py b/config.py index f94f183..e3adeb2 100644 --- a/config.py +++ b/config.py @@ -24,6 +24,9 @@ else: # 对话窗的高度 CHATBOT_HEIGHT = 1115 +# 代码高亮 +CODE_HIGHLIGHT = True + # 窗口布局 LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局) diff --git a/theme.py b/theme.py index 0205ae4..8385dce 100644 --- a/theme.py +++ b/theme.py @@ -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 */