[MainWindow] ThemeSync: Better error handling if var not found
This commit is contained in:
parent
8aee54ba7a
commit
314afbfe5f
|
@ -1,9 +1,9 @@
|
|||
let lastBgPrimary = '';
|
||||
const themesync = async () => {
|
||||
const getVar = (name, el = document.body) => el && (getComputedStyle(el).getPropertyValue(name) || getVar(name, el.parentElement)).trim();
|
||||
const getVar = (name, el = document.body) => el && (getComputedStyle(el).getPropertyValue(name) || getVar(name, el.parentElement))?.trim();
|
||||
|
||||
const bgPrimary = getVar('--background-primary');
|
||||
if (bgPrimary === '#36393f' || bgPrimary === lastBgPrimary) return; // Default primary bg or same as last
|
||||
if (!bgPrimary || bgPrimary === '#36393f' || bgPrimary === lastBgPrimary) return; // Default primary bg or same as last
|
||||
lastBgPrimary = bgPrimary;
|
||||
|
||||
const vars = [ '--background-primary', '--background-secondary', '--brand-experiment', '--header-primary', '--text-muted' ];
|
||||
|
|
Loading…
Reference in New Issue