Theme Chooser
Choose a new theme to apply:
var configFile = 'config.json'; // Load the config on startup $(window).on('xpboot', function() { loadConfig(); }); function saveConfig(callback) { if (!loadingconfig) { config.wallpaper = xp.wallpaper.href; config.profile = xp.profile; config.theme = xp.theme.name; xp.filesystem.writeFile(configFile, new Blob([JSON.stringify(config)], {type: 'text/plain'}), (e) => { if (e) xp.error(e); else if (callback !== undefined) callback(); }); } } function loadConfig(callback) { loadingconfig = true; xp.filesystem.readFile(configFile, (text) => { try { config = JSON.parse(text); xp.wallpaper.set(config.wallpaper || 'https://rebornxp.js.org/system/themes/XP.jpg'); xp.profile = config.profile; xp.theme.set(config.theme || 'reborn'); } catch (e) { xp.wallpaper.set('https://rebornxp.js.org/system/themes/XP.jpg'); loadingconfig = false; saveConfig(); } loadingconfig = false; if (callback !== undefined) callback(); }); } // Add theme chooser to Control Panel xp.controlpanel.add('Themes', () => { var win = new Window({ width: 400, height: 200, // Increased height to accommodate the wallpaper change option title: 'Change Theme', canResize: false, }); win.content(`
Choose a new theme to apply:
Select a wallpaper:
Choose a new theme to apply:
Select a wallpaper: