Skip to content

Instantly share code, notes, and snippets.

@fallaciousreasoning
Created July 30, 2019 06:25
Show Gist options
  • Save fallaciousreasoning/c5cbbaf3cfd531f758575413edfde7a8 to your computer and use it in GitHub Desktop.
Save fallaciousreasoning/c5cbbaf3cfd531f758575413edfde7a8 to your computer and use it in GitHub Desktop.
A ViolentMonkey/TamperMonkey/GreaseMonkey script for keeping add/updating a meta theme-color tag for Outlook.com
// ==UserScript==
// @name Set Outlook Theme Color
// @namespace Violentmonkey Scripts
// @match https://outlook.live.com/mail/*
// @grant none
// ==/UserScript==
function updateThemeColor() {
let themeMeta = document.querySelector("meta[name=theme-color]");
if (!themeMeta) {
themeMeta = document.createElement('meta');
themeMeta.innerHTML = `<meta name="theme-color">`;
document.head.appendChild(themeMeta);
}
const themeColor = getComputedStyle(document.body).getPropertyValue('--headerBackground')
themeMeta.setAttribute("content", themeColor);
};
const poll = (func, regularity) => {
func();
setTimeout(() => {
poll(func, regularity);
}, regularity)
};
poll(updateThemeColor, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment