-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathapply_css_fixes.py
More file actions
48 lines (39 loc) · 1.24 KB
/
Copy pathapply_css_fixes.py
File metadata and controls
48 lines (39 loc) · 1.24 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
import re
files = [
'Frontend/style.css',
'Frontend/Analysis/analysis.css'
]
hidden_css = """
.hidden {
display: none !important;
opacity: 0 !important;
pointer-events: none !important;
visibility: hidden !important;
}
.chatbot-panel:not(.hidden) {
opacity: 1 !important;
pointer-events: auto !important;
visibility: visible !important;
transform: translateY(0) !important;
}
"""
accent_css = """
--accent: #0284c7;
--accent-2: #0369a1;
"""
for filepath in files:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# 1. Add .hidden if it's missing or incomplete
if '.hidden {' not in content:
content += hidden_css
elif '.chatbot-panel:not(.hidden)' not in content:
content += "\n.chatbot-panel:not(.hidden) { opacity: 1 !important; pointer-events: auto !important; visibility: visible !important; }\n"
# 2. Add --accent to [data-theme="light"]
if '--accent: #0284c7' not in content:
# find [data-theme="light"] {
pattern = r'(\[data-theme="light"\]\s*\{)'
content = re.sub(pattern, r'\1' + accent_css, content, count=1)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("CSS fixes applied successfully.")