Your Name commited on
Commit
476a174
1 Parent(s): e371b82

代码高亮开关

Browse files
Files changed (2) hide show
  1. config.py +3 -0
  2. theme.py +4 -2
config.py CHANGED
@@ -24,6 +24,9 @@ else:
24
  # 对话窗的高度
25
  CHATBOT_HEIGHT = 1115
26
 
 
 
 
27
  # 窗口布局
28
  LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)
29
 
 
24
  # 对话窗的高度
25
  CHATBOT_HEIGHT = 1115
26
 
27
+ # 代码高亮
28
+ CODE_HIGHLIGHT = True
29
+
30
  # 窗口布局
31
  LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)
32
 
theme.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
-
 
3
  # gradio可用颜色列表
4
  # gr.themes.utils.colors.slate (石板色)
5
  # gr.themes.utils.colors.gray (灰色)
@@ -155,7 +156,8 @@ advanced_css = """
155
  }
156
  """
157
 
158
- advanced_css += """
 
159
  .hll { background-color: #ffffcc }
160
  .c { color: #3D7B7B; font-style: italic } /* Comment */
161
  .err { border: 1px solid #FF0000 } /* Error */
 
1
  import gradio as gr
2
+ from toolbox import get_conf
3
+ CODE_HIGHLIGHT, = get_conf('CODE_HIGHLIGHT')
4
  # gradio可用颜色列表
5
  # gr.themes.utils.colors.slate (石板色)
6
  # gr.themes.utils.colors.gray (灰色)
 
156
  }
157
  """
158
 
159
+ if CODE_HIGHLIGHT:
160
+ advanced_css += """
161
  .hll { background-color: #ffffcc }
162
  .c { color: #3D7B7B; font-style: italic } /* Comment */
163
  .err { border: 1px solid #FF0000 } /* Error */