Fix modal border and improve light mode firecracker colors
This commit is contained in:
@@ -64,21 +64,15 @@ def port_html():
|
||||
# Inject theme initialization at start of script block
|
||||
init_theme_script = """<script>
|
||||
(function(){
|
||||
let isLight = false;
|
||||
try {
|
||||
isLight = !window.parent.document.documentElement.classList.contains('dark');
|
||||
} catch (e) {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
isLight = p.get('theme') === 'light';
|
||||
}
|
||||
window.isLightTheme = isLight;
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
window.isLightTheme = p.get('theme') === 'light';
|
||||
})();
|
||||
"""
|
||||
html = html.replace("<script>", init_theme_script, 1)
|
||||
|
||||
# Make firecracker spark/confetti arrays dynamic based on theme
|
||||
spark_replacement = "const SPARK=window.isLightTheme?['#e28a22','#c2410c','#b45309','#78350f','#ea580c','#3b82f6']:['#f6dd93','#e8c463','#d4af37','#fff4cf','#ffffff','#8fb4ff'];"
|
||||
conf_replacement = "const CONF=window.isLightTheme?['#e28a22','#c2410c','#b45309','#ea580c','#ef4444','#3b82f6','#10b981']:['#f6dd93','#e8c463','#d4af37','#ffffff','#ffd34d'];"
|
||||
spark_replacement = "const SPARK=window.isLightTheme?['#b91c1c','#c2410c','#1d4ed8','#15803d','#7e22ce','#0f172a']:['#f6dd93','#e8c463','#d4af37','#fff4cf','#ffffff','#8fb4ff'];"
|
||||
conf_replacement = "const CONF=window.isLightTheme?['#b91c1c','#c2410c','#1d4ed8','#15803d','#7e22ce','#0f172a','#b45309']:['#f6dd93','#e8c463','#d4af37','#ffffff','#ffd34d'];"
|
||||
html = re.sub(r"const SPARK\s*=\s*\[[^\]]*\];", spark_replacement, html)
|
||||
html = re.sub(r"const CONF\s*=\s*\[[^\]]*\];", conf_replacement, html)
|
||||
|
||||
@@ -112,15 +106,9 @@ def port_html():
|
||||
<script>
|
||||
(function(){
|
||||
setInterval(() => {
|
||||
let isLight = false;
|
||||
try {
|
||||
isLight = !window.parent.document.documentElement.classList.contains('dark');
|
||||
} catch (e) {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
isLight = p.get('theme') === 'light';
|
||||
}
|
||||
|
||||
window.isLightTheme = isLight;
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
window.isLightTheme = p.get('theme') === 'light';
|
||||
const isLight = window.isLightTheme;
|
||||
|
||||
if (isLight) {
|
||||
document.body.style.setProperty('background', '#ffffff', 'important');
|
||||
|
||||
Reference in New Issue
Block a user