Last active
September 30, 2021 03:47
-
-
Save gprasanth/6b58679eafe8f13faafced6df7f0aac2 to your computer and use it in GitHub Desktop.
Google Chat Dark Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Dark Chat | |
// @namespace https://gprasanth.in/ | |
// @version 1.337 | |
// @description Dark Mode support for Google Chat! Already!! | |
// @author @gprasanth | |
// @match https://chat.google.com/* | |
// @downloadURL https://gist.githack.com/gprasanth/6b58679eafe8f13faafced6df7f0aac2/raw/dark-chat.user.js | |
// @updateURL https://gist.githack.com/gprasanth/6b58679eafe8f13faafced6df7f0aac2/raw/dark-chat.user.js | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const includeScript = function (url) { | |
var script = document.createElement("script"); | |
script.src = url; | |
document.head.appendChild(script); | |
}; | |
const joinDarkSide = function () { | |
includeScript('https://cdn.jsdelivr.net/gh/gprasanth/gchat-themes@master/dist/standalone/dark-mode.js'); | |
}; | |
const stayGreen = function () { | |
includeScript('https://cdn.jsdelivr.net/gh/gprasanth/gchat-themes@master/dist/standalone/slack-mode.js'); | |
}; | |
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { | |
if (e.matches) joinDarkSide(); | |
else stayGreen(); | |
}); | |
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) joinDarkSide(); | |
else stayGreen(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment