Skip to content

Instantly share code, notes, and snippets.

@mingming-cn
Last active December 26, 2023 14:54
Show Gist options
  • Save mingming-cn/d515bf25d9d9c278ccf2982248ea21ed to your computer and use it in GitHub Desktop.
Save mingming-cn/d515bf25d9d9c278ccf2982248ea21ed to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Grafana Theme light
// @namespace https://mingming.wang/
// @version 0.1.0
// @description grafana theme light
// @author mingming-cn
// @match http://*.u4/*
// @icon https://grafana.com/static/assets/img/fav32.png
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @homePage https://gist.githubusercontent.com/mingming-cn/d515bf25d9d9c278ccf2982248ea21ed
// @updateURL https://gist.githubusercontent.com/mingming-cn/d515bf25d9d9c278ccf2982248ea21ed/raw/044208dbe90b12eb0afa1b55015996abca13566e/grafana-theme-light.js
// ==/UserScript==
window.addEventListener('load', function() {
'use strict';
waitForKeyElements(".app-grafana", changeTheme);
function changeTheme (jNode) {
if(jNode && !jNode.hasClass("theme-light")){
let param = '&theme=light';
if (window.document.location.href.indexOf('?') < 0) {
param = '?theme=light';
}
window.document.location.href += param;
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment