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 || '';
opt.hideDelay = Math.max(0, opt.hideDelay) || 2000;
$root.classList.add(CSS_PREFIX + 'theme-' +
(opt.theme === 'dark' || opt.theme === 'light' ?
opt.theme :
guessTheme()));
$root.className = $root.className.replace(new RegExp(CSS_PREFIX + 'theme-\\S+\\s*'), '') +
' ' + CSS_PREFIX + 'theme-' +
(opt.theme === 'dark' || opt.theme === 'light' ? opt.theme :
guessTheme());
document.body.appendChild($root);
if (!isNaN(options.left) && !isNaN(options.top)) {