From 476a174320a8b0712bcebb0d4e0523fca6a46036 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 8 Apr 2023 00:41:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=AB=98=E4=BA=AE=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 3 +++ theme.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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 */