akhaliq HF staff commited on
Commit
71d5621
·
verified ·
1 Parent(s): ce95748

support dark mode

Browse files
Files changed (1) hide show
  1. app.py +57 -31
app.py CHANGED
@@ -55,7 +55,7 @@ class PaperManager:
55
 
56
  return f"""
57
  <tr class="athing">
58
- <td align="right" valign="top" class="title"><span class="rank">{rank}.</span></td>
59
  <td valign="top" class="title">
60
  <a href="{url}" class="storylink" target="_blank">{title}</a>
61
  </td>
@@ -108,97 +108,123 @@ def refresh_papers():
108
  else:
109
  return "<div class='no-papers'>Failed to refresh papers. Please try again later.</div>"
110
 
 
111
  css = """
 
112
  body {
113
- background-color: white;
114
  font-family: Verdana, Geneva, sans-serif;
115
  margin: 0;
116
  padding: 0;
 
117
  }
118
 
 
119
  a {
120
- color: #0000ff;
121
  text-decoration: none;
122
  }
123
 
124
  a:visited {
125
- color: #551A8B;
126
  }
127
 
 
128
  .container {
129
  width: 85%;
130
  margin: auto;
 
 
 
131
  }
132
 
 
133
  table {
134
  width: 100%;
 
 
 
135
  }
136
 
137
- .header-table {
138
- width: 100%;
139
- background-color: #ff6600;
140
- padding: 2px 10px;
141
  }
142
 
143
- .header-table a {
144
- color: black;
145
- font-weight: bold;
146
- font-size: 14pt;
147
- text-decoration: none;
148
  }
149
 
150
- .itemlist .athing {
151
- background-color: #f6f6ef;
 
152
  }
153
 
154
  .rank {
155
  font-size: 14pt;
156
- color: #828282;
157
- padding-right: 5px;
158
  }
159
 
160
  .storylink {
161
- font-size: 10pt;
 
162
  }
163
 
164
  .subtext {
165
- font-size: 8pt;
166
- color: #828282;
167
- padding-left: 40px;
168
  }
169
 
170
- .subtext a {
171
- color: #828282;
 
 
 
 
 
 
 
 
 
172
  text-decoration: none;
173
  }
174
 
 
175
  #refresh-button {
176
- background: none;
177
  border: none;
178
  color: black;
179
  font-weight: bold;
180
  font-size: 14pt;
181
  cursor: pointer;
 
 
182
  }
183
 
 
 
 
 
 
184
  .no-papers {
185
  text-align: center;
186
- color: #828282;
187
- padding: 1rem;
188
- font-size: 14pt;
189
  }
190
 
 
191
  @media (max-width: 640px) {
192
  .header-table a {
193
- font-size: 12pt;
194
  }
195
 
196
  .storylink {
197
- font-size: 9pt;
198
  }
199
 
200
  .subtext {
201
- font-size: 7pt;
202
  }
203
  }
204
  """
@@ -248,4 +274,4 @@ with demo:
248
  </script>
249
  """)
250
 
251
- demo.launch()
 
55
 
56
  return f"""
57
  <tr class="athing">
58
+ <td align="right" valign="top" class="rank"><span>{rank}.</span></td>
59
  <td valign="top" class="title">
60
  <a href="{url}" class="storylink" target="_blank">{title}</a>
61
  </td>
 
108
  else:
109
  return "<div class='no-papers'>Failed to refresh papers. Please try again later.</div>"
110
 
111
+ # Dark Mode CSS
112
  css = """
113
+ /* Base Styling */
114
  body {
115
+ background-color: #121212; /* Dark background for the entire app */
116
  font-family: Verdana, Geneva, sans-serif;
117
  margin: 0;
118
  padding: 0;
119
+ color: #e0e0e0; /* Light text color for dark mode */
120
  }
121
 
122
+ /* Links */
123
  a {
124
+ color: #bb86fc; /* Light purple for links */
125
  text-decoration: none;
126
  }
127
 
128
  a:visited {
129
+ color: #8f56c1; /* Darker purple for visited links */
130
  }
131
 
132
+ /* Container */
133
  .container {
134
  width: 85%;
135
  margin: auto;
136
+ background-color: #1e1e1e; /* Dark background for the container */
137
+ padding: 20px;
138
+ border-radius: 8px;
139
  }
140
 
141
+ /* Table */
142
  table {
143
  width: 100%;
144
+ background-color: #1e1e1e; /* Dark background for the table */
145
+ border-spacing: 0;
146
+ border-collapse: collapse;
147
  }
148
 
149
+ tr.athing {
150
+ background-color: #2c2c2c; /* Slightly lighter dark color for rows */
 
 
151
  }
152
 
153
+ tr.athing:nth-child(even) {
154
+ background-color: #232323; /* Alternate row color */
 
 
 
155
  }
156
 
157
+ .rank, .storylink, .subtext {
158
+ padding: 10px;
159
+ border-bottom: 1px solid #333; /* Border between rows */
160
  }
161
 
162
  .rank {
163
  font-size: 14pt;
164
+ color: #bbbbbb;
165
+ padding-right: 10px;
166
  }
167
 
168
  .storylink {
169
+ font-size: 12pt;
170
+ color: #bb86fc; /* Light purple for story titles */
171
  }
172
 
173
  .subtext {
174
+ font-size: 10pt;
175
+ color: #888888; /* Light gray for subtext */
 
176
  }
177
 
178
+ /* Header Styling */
179
+ .header-table {
180
+ width: 100%;
181
+ background-color: #ff6600;
182
+ padding: 10px 20px;
183
+ }
184
+
185
+ .header-table a {
186
+ color: black;
187
+ font-weight: bold;
188
+ font-size: 18pt;
189
  text-decoration: none;
190
  }
191
 
192
+ /* Refresh Button */
193
  #refresh-button {
194
+ background: #ff6600;
195
  border: none;
196
  color: black;
197
  font-weight: bold;
198
  font-size: 14pt;
199
  cursor: pointer;
200
+ padding: 10px 20px;
201
+ border-radius: 5px;
202
  }
203
 
204
+ #refresh-button:hover {
205
+ background-color: #e55b00; /* Slightly darker orange on hover */
206
+ }
207
+
208
+ /* No Papers Section */
209
  .no-papers {
210
  text-align: center;
211
+ color: #bbbbbb;
212
+ padding: 20px;
213
+ font-size: 16pt;
214
  }
215
 
216
+ /* Responsive Styles */
217
  @media (max-width: 640px) {
218
  .header-table a {
219
+ font-size: 14pt;
220
  }
221
 
222
  .storylink {
223
+ font-size: 10pt;
224
  }
225
 
226
  .subtext {
227
+ font-size: 9pt;
228
  }
229
  }
230
  """
 
274
  </script>
275
  """)
276
 
277
+ demo.launch()