v1.8.12: branding colors — full override including glass borders, glows, rgba values via applyBrandingColors()
This commit is contained in:
+2
-17
@@ -1525,15 +1525,7 @@ async function loadBranding() {
|
||||
document.getElementById('b-secondary-hex').value = d.secondary_color||'#95d3ba';
|
||||
document.getElementById('preview-primary').style.background = d.primary_color||'#4edea3';
|
||||
document.getElementById('preview-secondary').style.background = d.secondary_color||'#95d3ba';
|
||||
// Apply colors live to admin CSS variables + override Tailwind classes
|
||||
if(d.primary_color || d.secondary_color) {
|
||||
const p=d.primary_color||'#4edea3', s=d.secondary_color||'#95d3ba';
|
||||
document.documentElement.style.setProperty('--primary', p);
|
||||
document.documentElement.style.setProperty('--secondary', s);
|
||||
let bs = document.getElementById('branding-color-override');
|
||||
if(!bs){bs=document.createElement('style');bs.id='branding-color-override';document.head.appendChild(bs);}
|
||||
bs.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}.hover\:text-primary:hover{color:${p}!important}.focus\:border-primary:focus{border-color:${p}!important}`;
|
||||
}
|
||||
applyBrandingColors(d.primary_color, d.secondary_color);
|
||||
// Logo
|
||||
if(d.logo_url) document.getElementById('b-logo').value = d.logo_url;
|
||||
if(d.logo_size) document.getElementById('b-logo-size').value = d.logo_size;
|
||||
@@ -1554,14 +1546,7 @@ async function saveBranding() {
|
||||
toast('Branding saved!','success');
|
||||
const p=document.getElementById('b-primary-hex')?.value;
|
||||
const s=document.getElementById('b-secondary-hex')?.value;
|
||||
if(p||s){
|
||||
const pc=p||'#4edea3', sc=s||'#95d3ba';
|
||||
document.documentElement.style.setProperty('--primary',pc);
|
||||
document.documentElement.style.setProperty('--secondary',sc);
|
||||
let bs=document.getElementById('branding-color-override');
|
||||
if(!bs){bs=document.createElement('style');bs.id='branding-color-override';document.head.appendChild(bs);}
|
||||
bs.textContent=`.text-primary{color:${pc}!important}.bg-primary{background-color:${pc}!important}.border-primary{border-color:${pc}!important}.text-secondary{color:${sc}!important}.hover\:text-primary:hover{color:${pc}!important}`;
|
||||
}
|
||||
if(p||s) applyBrandingColors(p,s);
|
||||
} else { alert('Save failed'); }
|
||||
} catch(e) { alert('Error: '+e.message); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user