Page 1 of 1

Fix for theme switcher

Posted: 2024-09-29 16:02
by SkayyHH
Anyone who notices flickering with the theme switcher can use this fix in header-extras.php. It loads the themes before any flickering occurs.


<script>
(function() {
var theme = localStorage.getItem('theme') || 'light.css'; // Default ist Light Theme
var prePath = <?php echo json_encode(PREPEND_PATH); ?>;
if(theme) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = prePath + 'resources/initializr/css/' + theme;
document.head.appendChild(link);
}
})();
</script>

Re: Fix for theme switcher

Posted: 2024-09-30 13:39
by a.gneady
Thanks for sharing!