v1.8.11: fix branding colors — inject style overrides for Tailwind classes, sync color picker with hex input
This commit is contained in:
+21
-2
@@ -373,8 +373,27 @@ let currentUser = null;
|
||||
fetch('/branding').then(r=>r.json()).then(b=>{
|
||||
if(b.site_name){document.title=b.site_name;const bn=document.getElementById('brand-name');if(bn)bn.textContent=b.site_name;}
|
||||
if(b.site_subtitle){const bs=document.getElementById('brand-sub');if(bs)bs.textContent=b.site_subtitle;}
|
||||
if(b.primary_color) document.documentElement.style.setProperty('--primary', b.primary_color);
|
||||
if(b.secondary_color) document.documentElement.style.setProperty('--secondary', b.secondary_color);
|
||||
if(b.primary_color || b.secondary_color) {
|
||||
const p = b.primary_color || '#4edea3';
|
||||
const s = b.secondary_color || '#95d3ba';
|
||||
document.documentElement.style.setProperty('--primary', p);
|
||||
document.documentElement.style.setProperty('--secondary', s);
|
||||
// Override Tailwind hardcoded colors with dynamic style injection
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.text-primary { color: ${p} !important; }
|
||||
.bg-primary { background-color: ${p} !important; }
|
||||
.border-primary { border-color: ${p} !important; }
|
||||
.text-secondary { color: ${s} !important; }
|
||||
.bg-secondary { background-color: ${s} !important; }
|
||||
.border-secondary { border-color: ${s} !important; }
|
||||
.hover\\:text-primary:hover { color: ${p} !important; }
|
||||
.hover\\:bg-primary:hover { background-color: ${p} !important; }
|
||||
.focus\\:border-primary:focus { border-color: ${p} !important; }
|
||||
.shadow-primary { --tw-shadow-color: ${p}; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
if(b.logo_url){
|
||||
const logo=document.getElementById('brand-logo');
|
||||
if(logo){logo.src=b.logo_url;logo.style.height=(b.logo_size||'40')+'px';logo.classList.remove('hidden');}
|
||||
|
||||
Reference in New Issue
Block a user