colorpicker: remove old theme class on re-invocation

This commit is contained in:
tophf 2017-12-18 09:54:41 +03:00
parent fd047f8323
commit f29e3bc587

View File

@ -197,10 +197,10 @@
$formatChangeButton.title = opt.tooltipForSwitcher || ''; $formatChangeButton.title = opt.tooltipForSwitcher || '';
opt.hideDelay = Math.max(0, opt.hideDelay) || 2000; opt.hideDelay = Math.max(0, opt.hideDelay) || 2000;
$root.classList.add(CSS_PREFIX + 'theme-' + $root.className = $root.className.replace(new RegExp(CSS_PREFIX + 'theme-\\S+\\s*'), '') +
(opt.theme === 'dark' || opt.theme === 'light' ? ' ' + CSS_PREFIX + 'theme-' +
opt.theme : (opt.theme === 'dark' || opt.theme === 'light' ? opt.theme :
guessTheme())); guessTheme());
document.body.appendChild($root); document.body.appendChild($root);
if (!isNaN(options.left) && !isNaN(options.top)) { if (!isNaN(options.left) && !isNaN(options.top)) {