qingxu99 commited on
Commit
1eb0174
1 Parent(s): 5a83b3b

新增DARK_MODE选项,可选择默认颜色模式

Browse files
Files changed (2) hide show
  1. config.py +1 -0
  2. main.py +3 -1
config.py CHANGED
@@ -33,6 +33,7 @@ CODE_HIGHLIGHT = True
33
 
34
  # 窗口布局
35
  LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)
 
36
 
37
  # 发送请求到OpenAI后,等待多久判定为超时
38
  TIMEOUT_SECONDS = 30
 
33
 
34
  # 窗口布局
35
  LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)
36
+ DARK_MODE = True # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布局)
37
 
38
  # 发送请求到OpenAI后,等待多久判定为超时
39
  TIMEOUT_SECONDS = 30
main.py CHANGED
@@ -186,7 +186,9 @@ def main():
186
  print(f"\t(暗色主题): http://localhost:{PORT}/?__dark-theme=true")
187
  def open():
188
  time.sleep(2) # 打开浏览器
189
- webbrowser.open_new_tab(f"http://localhost:{PORT}/?__dark-theme=true")
 
 
190
  threading.Thread(target=open, name="open-browser", daemon=True).start()
191
  threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start()
192
  threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()
 
186
  print(f"\t(暗色主题): http://localhost:{PORT}/?__dark-theme=true")
187
  def open():
188
  time.sleep(2) # 打开浏览器
189
+ DARK_MODE, = get_conf('DARK_MODE')
190
+ if DARK_MODE: webbrowser.open_new_tab(f"http://localhost:{PORT}/?__dark-theme=true")
191
+ else: webbrowser.open_new_tab(f"http://localhost:{PORT}")
192
  threading.Thread(target=open, name="open-browser", daemon=True).start()
193
  threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start()
194
  threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()