-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.py
More file actions
397 lines (382 loc) · 11.6 KB
/
Copy pathstyles.py
File metadata and controls
397 lines (382 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# styles.py
from __future__ import annotations
"""Application-wide style constants and helpers."""
C_BG = "#101012" # Primary window background for the dark theme.
C_PANEL = "#262626" # Generic panel background blocks.
C_ELEMENT_BORDER = "#242426" # Shared subtle 1px element border color.
C_LINE = C_ELEMENT_BORDER # Standard control border lines in global styles.
C_TEXT = "#D6D6D6" # Default foreground text color.
C_MUTED = "#8A8A8A" # Muted label text such as `#GroupTitle`.
C_MUTED2 = "#9B9B9B" # Secondary muted text, e.g. `#SmallMuted` labels.
C_LINE_NUM = "#555555" # Dim text for line numbers.
C_TOP_TEXT = "#6a6a72" # Foreground text for top panel controls.
C_TOP_SEPARATOR = C_ELEMENT_BORDER # Borders within the top panel controls.
C_TOP_PANEL_LINE = C_ELEMENT_BORDER # Subtle 1px top panel separators.
C_GREEN = "#00FA36" # High-quality rhyme highlight color.
C_YELLOW = "#C9A44C" # Medium-quality rhyme highlight color.
C_RED = "#CC49F6" # Low-quality rhyme highlight color.
C_SEPARATOR = "#4A90E2" # Accent separator color used across the UI.
TOP_PANEL_SEPARATOR_STYLESHEET = f"background-color: {C_TOP_PANEL_LINE};"
def color_for_level(level: str) -> str:
"""Return a hex color code for the given quality level."""
if level == "good":
return C_GREEN
if level == "mid":
return C_YELLOW
return C_RED
def build_app_styles(reading_mode: bool) -> str:
"""Construct the global application stylesheet."""
if reading_mode:
edit_bg = "transparent"
edit_border = "none"
edit_pad = "0px"
else:
edit_bg = "#1A1A1C"
edit_border = "none"
edit_pad = "6px 10px"
return f"""
QMainWindow {{
background: {C_BG};
color: {C_TEXT};
}}
QWidget {{
background: {C_BG};
color: {C_TEXT};
}}
QLabel {{
background: transparent;
color: {C_TEXT};
}}
QLabel#GroupTitle {{
color: {C_MUTED};
background: transparent;
}}
QLabel#SmallMuted {{
color: {C_MUTED2};
background: transparent;
}}
QLabel#LineNumber {{
color: {C_LINE_NUM};
background: transparent;
}}
QListWidget {{
background: {C_PANEL};
border: 1px solid {C_LINE};
padding: 6px;
}}
QListWidget::item {{
}}
QListWidget::item:selected {{
background: #2F2F2F;
}}
QComboBox {{
background: #202020;
border: 1px solid {C_LINE};
border-radius: 0px;
font: 10pt "Segoe UI";
padding: 5px 34px 5px 8px;
min-height: 24px;
selection-background-color: #333333;
}}
QComboBox:hover {{
background: #202020;
}}
QComboBox:focus {{
border: 1px solid {C_LINE};
}}
QComboBox::drop-down {{
subcontrol-origin: padding;
subcontrol-position: top right;
width: 28px;
border-left: 1px solid {C_LINE};
background: #202020;
}}
QComboBox::drop-down:hover {{
background: #202020;
}}
QComboBox::down-arrow {{
image: url(img/chevron-down.svg);
width: 16px;
height: 16px;
}}
QComboBox QAbstractItemView {{
background: #202020;
color: {C_TEXT};
border: none;
border-radius: 0px;
padding: 4px 0px;
outline: 0px;
selection-background-color: #333333;
selection-color: {C_TEXT};
}}
QComboBox QAbstractItemView::item {{
min-height: 28px;
padding: 5px 10px;
border: none;
}}
QComboBox QAbstractItemView::item:hover {{
background: #5B3A8C;
}}
QComboBox QAbstractItemView::item:selected {{
background: #333333;
}}
QComboBoxPrivateContainer {{
background: #202020;
border: none;
border-radius: 0px;
}}
QComboBoxPrivateContainer QAbstractItemView {{
border: none;
border-radius: 0px;
}}
QComboBoxPrivateContainer QScrollBar:vertical,
QComboBoxPrivateContainer QScrollBar:horizontal,
QComboBox QAbstractItemView QScrollBar:vertical,
QComboBox QAbstractItemView QScrollBar:horizontal {{
width: 0px;
height: 0px;
border: none;
background: transparent;
}}
QAbstractItemView {{
border-radius: 0px;
}}
QSpinBox {{
background: #2B2B2B;
border: none;
padding: 4px 6px;
border-radius: 0px;
}}
QCheckBox {{
spacing: 8px;
background: transparent;
}}
QMenuBar {{
background: {C_BG};
border: none;
border-radius: 0px;
padding: 2px 0px;
}}
QMenuBar::item {{
background: transparent;
padding: 6px 12px;
border: none;
border-radius: 0px;
color: {C_TEXT};
}}
QMenuBar::item:selected {{
background: #242426;
}}
QMenu {{
background-color: #202020;
color: {C_TEXT};
border: 1px solid {C_LINE};
border-radius: 0px;
outline: 0px;
padding: 4px 0px;
font: 10pt "Segoe UI";
}}
QMenu::item {{
background-color: transparent;
min-height: 28px;
padding: 0px 10px;
border: none;
border-radius: 0px;
color: {C_TEXT};
}}
QMenu::item:selected {{
background-color: #242426;
color: {C_TEXT};
}}
QMenu::item:pressed {{
background-color: #2B2B2B;
}}
QMenu::separator {{
height: 1px;
background-color: {C_LINE};
margin: 4px 8px;
}}
QMenu QWidget {{
background-color: #202020;
}}
QPushButton, QToolButton {{
background: #2B2B2B;
border: 1px solid {C_LINE};
padding: 6px 10px;
border-radius: 8px;
}}
QPushButton:hover, QToolButton:hover {{
}}
QPushButton:pressed, QToolButton:pressed {{
background: #262626;
}}
QToolButton#BlockAddButton {{
background: transparent;
border: 1px solid {C_LINE};
padding: 6px 10px;
border-radius: 8px;
}}
QToolButton#BlockAddButton:hover,
QToolButton#BlockAddButton:pressed {{
background: transparent;
}}
QToolButton#BlockIconButton {{
background: transparent;
border: none;
padding: 0px;
border-radius: 0px;
}}
QToolButton#BlockIconButton:hover,
QToolButton#BlockIconButton:pressed {{
background: transparent;
border: none;
}}
QLineEdit, QPlainTextEdit {{
background: {edit_bg};
border: {edit_border};
padding: {edit_pad};
border-radius: 0px;
selection-background-color: #3A3A3A;
}}
QPlainTextEdit {{
color: {C_TEXT};
background: {edit_bg};
background-color: {edit_bg};
}}
"""
def build_top_panel_styles() -> str:
"""Construct stylesheet fragment used by the top control panel."""
return f"""
QWidget#TopPanel, QWidget#TopPanel QLabel,
QWidget#BottomPanel, QWidget#BottomPanel QLabel, QRadioButton {{
color: {C_TOP_TEXT};
background-color: transparent;
}}
QWidget#TopPanel QSpinBox, QWidget#TopPanel QLineEdit,
QWidget#BottomPanel QSpinBox, QWidget#BottomPanel QLineEdit {{
color: {C_TOP_TEXT};
background-color: #1A1A1C;
border: none;
padding: 4px 6px;
border-radius: 0px;
}}
QWidget#TopPanel QComboBox, QWidget#BottomPanel QComboBox {{
color: {C_TEXT};
background-color: #202020;
border: 1px solid {C_TOP_SEPARATOR};
border-radius: 0px;
font: 10pt "Segoe UI";
padding: 5px 34px 5px 8px;
min-height: 24px;
}}
QWidget#TopPanel QComboBox:hover, QWidget#BottomPanel QComboBox:hover {{
background-color: #202020;
}}
QWidget#TopPanel QComboBox:focus, QWidget#BottomPanel QComboBox:focus {{
border: 1px solid {C_TOP_SEPARATOR};
}}
QWidget#TopPanel QComboBox::drop-down, QWidget#BottomPanel QComboBox::drop-down {{
subcontrol-origin: padding;
subcontrol-position: top right;
width: 28px;
border-left: 1px solid {C_TOP_SEPARATOR};
background: #202020;
}}
QWidget#TopPanel QComboBox::drop-down:hover, QWidget#BottomPanel QComboBox::drop-down:hover {{
background-color: #202020;
}}
QWidget#TopPanel QComboBox::down-arrow, QWidget#BottomPanel QComboBox::down-arrow {{
image: url(img/chevron-down.svg);
width: 16px;
height: 16px;
}}
QWidget#TopPanel QComboBox QAbstractItemView,
QWidget#BottomPanel QComboBox QAbstractItemView {{
background: #202020;
color: {C_TEXT};
border: none;
border-radius: 0px;
padding: 4px 0px;
outline: 0px;
selection-background-color: #333333;
selection-color: {C_TEXT};
}}
QWidget#TopPanel QComboBox QAbstractItemView::item,
QWidget#BottomPanel QComboBox QAbstractItemView::item {{
min-height: 28px;
padding: 5px 10px;
border: none;
border-radius: 0px;
}}
QWidget#TopPanel QComboBox QAbstractItemView::item:selected,
QWidget#BottomPanel QComboBox QAbstractItemView::item:selected {{
background: #333333;
}}
QWidget#TopPanel QComboBox QAbstractItemView::item:hover,
QWidget#BottomPanel QComboBox QAbstractItemView::item:hover {{
background: #5B3A8C;
}}
QWidget#TopPanel QComboBoxPrivateContainer,
QWidget#BottomPanel QComboBoxPrivateContainer {{
background: #202020;
border: none;
border-radius: 0px;
}}
QWidget#TopPanel QComboBoxPrivateContainer QScrollBar:vertical,
QWidget#TopPanel QComboBoxPrivateContainer QScrollBar:horizontal,
QWidget#BottomPanel QComboBoxPrivateContainer QScrollBar:vertical,
QWidget#BottomPanel QComboBoxPrivateContainer QScrollBar:horizontal {{
width: 0px;
height: 0px;
border: none;
background: transparent;
}}
QWidget#TopPanel QPushButton, QWidget#BottomPanel QPushButton {{
color: {C_TOP_TEXT};
background-color: rgba(255, 255, 255, 0.05);
border: 1px solid {C_TOP_SEPARATOR};
padding: 4px 12px;
border-radius: 6px;
}}
QWidget#TopPanel QPushButton:hover, QWidget#BottomPanel QPushButton:hover {{
background-color: rgba(255, 255, 255, 0.1);
}}
QWidget#TopPanel QRadioButton::indicator, QWidget#BottomPanel QRadioButton::indicator {{
width: 12px;
height: 12px;
border-radius: 6px;
border: 1px solid {C_TOP_SEPARATOR};
}}
QWidget#TopPanel QRadioButton::indicator:checked,
QWidget#BottomPanel QRadioButton::indicator:checked {{
background-color: {C_TOP_TEXT};
border: 1px solid {C_TOP_SEPARATOR};
}}
QWidget#TopPanel QSpinBox:disabled, QWidget#BottomPanel QSpinBox:disabled {{
background-color: rgba(255, 255, 255, 0.04);
}}
QWidget#TopPanel QToolButton, QWidget#BottomPanel QToolButton {{
border: none;
background: transparent;
}}
QWidget#TopPanel QToolButton:checked, QWidget#BottomPanel QToolButton:checked {{
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
}}
QWidget#TopPanel QToolButton#ReadingModeButton {{
border: none;
background: transparent;
padding: 0px;
margin: 0px;
min-width: 34px;
max-width: 34px;
min-height: 34px;
max-height: 34px;
}}
QWidget#TopPanel QToolButton#ReadingModeButton:hover,
QWidget#TopPanel QToolButton#ReadingModeButton:pressed,
QWidget#TopPanel QToolButton#ReadingModeButton:checked {{
border: none;
background: transparent;
}}
"""