NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name KatsuSwitch (Claude.ai Chat) // @namespace KatsuSwitch // @version 1.0.1 // @description Light/Dark Mode Toggle // @author Sato // @license MIT // @match https://claude.ai/* // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function () { 'use strict'; try { const html = document.querySelector('html'); if (!html) { throw new Error('HTML element not found'); } let currentMode = GM_getValue('mode'); console.log('Initial mode:', currentMode); html.setAttribute('data-mode', currentMode || 'light'); const updateMode = (newMode) => { console.log('Updating mode to:', newMode); GM_setValue('mode', newMode); currentMode = newMode; html.setAttribute('data-mode', currentMode); }; GM_registerMenuCommand('Toggle Mode', () => { try { const newMode = currentMode === 'light' ? 'dark' : 'light'; updateMode(newMode); } catch (error) { console.error('Error in Toggle Mode:', error); } }); window.addEventListener('load', () => { console.log('Page loaded, setting mode to:', currentMode); html.setAttribute('data-mode', currentMode || 'light'); }); } catch (error) { console.error('Error in userscript:', error); } })();