Repository navigation
Expand file tree
/
Copy pathfix_css.py
More file actions
122 lines (106 loc) · 2.78 KB
/
Copy pathfix_css.py
File metadata and controls
122 lines (106 loc) · 2.78 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
import sys
with open('src/index.css', 'r', encoding='utf-8') as f:
content = f.read()
replacement_root = """
:root {
--background: #f8fafc;
--foreground: #0f172a;
--card-bg: rgba(255, 255, 255, 0.85);
--border: rgba(226, 232, 240, 0.6);
--primary: #ec4899;
--primary-gradient: linear-gradient(135deg, #ec4899, #8b5cf6, #3b82f6);
--text-muted: #475569;
--danger: #ef4444;
}
[data-theme='dark'] {
--background: #0f172a;
--foreground: #f8fafc;
--card-bg: rgba(30, 41, 59, 0.85);
--border: rgba(51, 65, 85, 0.6);
--primary: #f472b6;
--primary-gradient: linear-gradient(135deg, #f472b6, #c084fc, #60a5fa);
--text-muted: #94a3b8;
--danger: #f87171;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(-45deg, #ff9a9e, #fecfef, #a1c4fd, #c2e9fb);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
color: var(--foreground);
transition: color 0.3s;
}
[data-theme='dark'] body {
background: linear-gradient(-45deg, #310e27, #240b36, #0f172a, #001f3f);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
}
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
"""
target_root = """
:root {
--background: #f8fafc;
--foreground: #0f172a;
--card-bg: #ffffff;
--border: #e2e8f0;
--primary: #3b82f6;
--text-muted: #64748b;
--danger: #ef4444;
}
[data-theme='dark'] {
--background: #0f172a;
--foreground: #f8fafc;
--card-bg: #1e293b;
--border: #334155;
--primary: #60a5fa;
--text-muted: #94a3b8;
--danger: #f87171;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
background-color: var(--background);
color: var(--foreground);
transition: background-color 0.3s, color 0.3s;
}
"""
replacement_btn = """
.btn-primary {
background: var(--primary-gradient);
color: white;
border: none;
font-weight: 600;
box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}
.btn-primary:hover:not(:disabled) {
opacity: 0.9;
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}
"""
target_btn = """
.btn-primary {
background-color: var(--primary);
color: white;
border: none;
font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
background-color: #2563eb;
}
[data-theme='dark'] .btn-primary:hover:not(:disabled) {
background-color: #3b82f6;
}
"""
content = content.replace(target_root.strip(), replacement_root.strip())
content = content.replace(target_btn.strip(), replacement_btn.strip())
with open('src/index.css', 'w', encoding='utf-8') as f:
f.write(content)
print("Updated CSS Theme")