fix(styles): synchronize accent across open apps
Quality / quality (ubuntu-latest) (push) Failing after 9m48s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 21:11:22 +05:30
parent 6133d33b8c
commit effed1c3cf
5 changed files with 20 additions and 3 deletions
+15
View File
@@ -745,6 +745,17 @@ export function renderThemeRuntime(theme: ResolvedTheme): string {
window.dispatchEvent(new CustomEvent("wrnexus:accent-changed",{detail:{accent:null}}));
}
function syncSharedAccent(){
var cookieAccent=readCookie(ACCENT_COOKIE);
var next=cookieAccent&&ACCENTS.indexOf(cookieAccent)>=0?cookieAccent:DEFAULT_ACCENT;
var current=el.getAttribute("data-accent");
if(next===current)return;
if(next)el.setAttribute("data-accent",next);else el.removeAttribute("data-accent");
syncStylesheet(getTheme(),next);
syncAccentButtons(document);
window.dispatchEvent(new CustomEvent("wrnexus:accent-changed",{detail:{accent:next}}));
}
function bind(root){
var target=root||document;
@@ -803,6 +814,10 @@ export function renderThemeRuntime(theme: ResolvedTheme): string {
};
window.addEventListener("wrnexus:navigated",function(){bind(document);});
window.addEventListener("focus",syncSharedAccent);
window.addEventListener("pageshow",syncSharedAccent);
document.addEventListener("visibilitychange",function(){if(!document.hidden)syncSharedAccent();});
window.setInterval(syncSharedAccent,1000);
if(document.readyState==="loading"){
document.addEventListener("DOMContentLoaded",function(){bind(document);});
}else{