Chaplain0908 commited on
Commit
ba23aff
·
verified ·
1 Parent(s): 6cd63b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -8
app.py CHANGED
@@ -70,28 +70,75 @@ st.set_page_config(
70
  #背景颜色
71
  st.markdown("""
72
  <style>
73
- /* 强制浅色模式,解决 HF 深色模式问题 */
74
- :root {
75
  color-scheme: light only !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
- html, body, [data-testid="stAppViewContainer"], [data-testid="stMain"] {
 
 
 
 
78
  background-color: #ffffff !important;
79
  color: #333333 !important;
80
  }
81
 
82
- /* 移除外层滚动,避免 HF iframe 双层滚动 */
83
- html, body {
 
 
 
 
 
84
  overflow: hidden !important;
85
- height: 100% !important;
86
  }
87
- [data-testid="stAppViewContainer"] {
 
 
 
 
 
88
  overflow-y: auto !important;
 
89
  height: 100vh !important;
90
  }
 
 
 
91
 
92
  /* 隐藏顶部深色栏 */
93
  header[data-testid="stHeader"] {
94
- background-color: #ffffff;
95
  }
96
 
97
  /* 左边侧边栏 - 灰色背景 */
 
70
  #背景颜色
71
  st.markdown("""
72
  <style>
73
+ /* 强制浅色模式 */
74
+ :root, html, body {
75
  color-scheme: light only !important;
76
+ background-color: #ffffff !important;
77
+ color: #333333 !important;
78
+ }
79
+
80
+ /* 全局强制浅色背景 */
81
+ *, *::before, *::after {
82
+ color-scheme: light only !important;
83
+ }
84
+
85
+ [data-testid="stAppViewContainer"],
86
+ [data-testid="stMain"],
87
+ [data-testid="stVerticalBlock"],
88
+ .stApp {
89
+ background-color: #ffffff !important;
90
+ color: #333333 !important;
91
+ }
92
+
93
+ /* Streamlit 组件强制浅色 */
94
+ [data-baseweb="select"],
95
+ [data-baseweb="input"],
96
+ [data-baseweb="popover"],
97
+ .stSelectbox > div,
98
+ .stTextInput > div {
99
+ background-color: #ffffff !important;
100
+ color: #333333 !important;
101
+ }
102
+
103
+ [data-baseweb="select"] > div {
104
+ background-color: #ffffff !important;
105
+ border-color: #ccc !important;
106
  }
107
+
108
+ /* 下拉菜单选项 */
109
+ [data-baseweb="menu"],
110
+ [data-baseweb="list"],
111
+ [role="listbox"] {
112
  background-color: #ffffff !important;
113
  color: #333333 !important;
114
  }
115
 
116
+ /* 单选按钮 */
117
+ .stRadio label {
118
+ color: #333333 !important;
119
+ }
120
+
121
+ /* 解决双层滚动:只保留一个滚动区域 */
122
+ html {
123
  overflow: hidden !important;
 
124
  }
125
+ body {
126
+ overflow: hidden !important;
127
+ height: 100vh !important;
128
+ margin: 0 !important;
129
+ }
130
+ .stApp {
131
  overflow-y: auto !important;
132
+ overflow-x: hidden !important;
133
  height: 100vh !important;
134
  }
135
+ [data-testid="stAppViewContainer"] {
136
+ overflow: visible !important;
137
+ }
138
 
139
  /* 隐藏顶部深色栏 */
140
  header[data-testid="stHeader"] {
141
+ background-color: #ffffff !important;
142
  }
143
 
144
  /* 左边侧边栏 - 灰色背景 */