Skip to content

Instantly share code, notes, and snippets.

@bergpb
Last active May 22, 2020 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergpb/2fddbc689a421adb30af85a3bd126a6b to your computer and use it in GitHub Desktop.
Save bergpb/2fddbc689a421adb30af85a3bd126a6b to your computer and use it in GitHub Desktop.
Tampermonkey script to turn on dark mode in whatsappweb based on current time
// ==UserScript==
// @name dark_mode_whatsappweb
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Activate dark mode in https://web.whatsapp.com/
// @author https://github.com/bergpb
// @match https://web.whatsapp.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
var time = (new Date()).getHours();
const dayTime = time > 6 && time < 18;
if(!dayTime){
console.log("It's a darkness night");
document.body.classList.add("dark");
} else {
console.log("It's a shining day");
}
})();
@Korb
Copy link

Korb commented May 22, 2020

Firefox 77.0b9 (64-bit), Tampermonkey 4.10.6112, Microsoft Windows 10.0.18363.836, WhatsApp Messenger (Beta) 2.20.157 - OK. However, it is a pity that the topic is dark, not black. That is, the predominant colors are dirty green, gray.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment