Skip to content

Instantly share code, notes, and snippets.

@theodric
Created July 14, 2025 15:06
Show Gist options
  • Save theodric/369718233115f28680749ab0d917678f to your computer and use it in GitHub Desktop.
Save theodric/369718233115f28680749ab0d917678f to your computer and use it in GitHub Desktop.
ViolentMonkey implementation of dark mode for Mikrotik web UI
// ==UserScript==
// @name Mikrotik Router Dark Mode
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Invert colors for Mikrotik router UI to create a dark mode effect
// @match http://10.10.11.254/webfig/*
// @match https://10.10.11.254/webfig/*
// @match http://gw/webfig/*
// @match http://gw.satcom/webfig/*
// @match http://gw.satcom.rowls/webfig/*
// @grant none
// @author ChatGPT
// @description 7/15/2024, 2:35:35 PM
// ==/UserScript==
(function() {
'use strict';
// Create a style element to hold our CSS
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
html {
filter: invert(100%);
background-color: #000;
}
img, video, object, embed {
filter: invert(100%);
}
`;
// Append the style element to the head of the document
document.head.appendChild(style);
// Optionally, if there are iframes, invert them as well
const iframes = document.getElementsByTagName('iframe');
for (let i = 0; i < iframes.length; i++) {
const iframe = iframes[i];
iframe.onload = function() {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const iframeStyle = iframeDoc.createElement('style');
iframeStyle.type = 'text/css';
iframeStyle.innerHTML = `
html {
filter: invert(100%);
background-color: #000;
}
img, video, object, embed {
filter: invert(100%);
}
`;
iframeDoc.head.appendChild(iframeStyle);
};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment