Reddit Auto Dark Mode

Change Reddit's theme based on your system theme

< Feedback on Reddit Auto Dark Mode

Review: OK - script works, but has bugs

§
Posted: 13-06-2024

If you're a moderator of any subreddit, the script (as of version 1.0) will end toggling the Mod Mode switch instead of the Dark Mode switch. To fix that, change line 13 from return document.querySelector('faceplate-switch-input'); to return document.querySelector('#darkmode-list-item > div > span.flex.items-center.shrink-0 > span > faceplate-switch-input');

Additionally, if you have issues with the switch quickly going back and forth between dark/light mode (ending mismatched with the browser setting), try increasing the timeout on line 25 (e.g. change it to setTimeout(() => toggleTheme(darkMedia.matches), 500) -- 500 seems to always work, while the default 300 from the script it normally triggers this bug)...

§
Posted: 20-08-2024

If you're a moderator of any subreddit, the script (as of version 1.0) will end toggling the Mod Mode switch instead of the Dark Mode switch. To fix that, change line 13 from return document.querySelector('faceplate-switch-input'); to return document.querySelector('#darkmode-list-item > div > span.flex.items-center.shrink-0 > span > faceplate-switch-input');

Additionally, if you have issues with the switch quickly going back and forth between dark/light mode (ending mismatched with the browser setting), try increasing the timeout on line 25 (e.g. change it to setTimeout(() => toggleTheme(darkMedia.matches), 500) -- 500 seems to always work, while the default 300 from the script it normally triggers this bug)...

The mod switch fix works great. The timeout change doesn't work for me on Firefox, dark mode flashes on briefly before returning to light mode. 300 still works fine strangely.

YukiteruAuthor
§
Posted: 13-09-2024

Thanks, fixed using your code

Post reply

Sign in to post a reply.