Last active
April 18, 2023 09:17
-
-
Save ovitrif/0159d4defb390cd76f648bfb073ca293 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Expose `setThemeColor` window function to color toolbar of Chrome PWAs | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description A simple script to make it easier to set the appbar of Chrome apps via a small running after it. | |
// @author @ovitrif | |
// @match https://*/* | |
// @icon none | |
// @grant none | |
// ==/UserScript== | |
window.setThemeColor = (color) => { | |
let name = 'theme-color'; | |
document.querySelector(`[name='${name}']`)?.remove() | |
let meta = document.createElement('meta'); | |
meta.name = name; | |
meta.content = color; | |
document.head.appendChild(meta); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment