/*jshint esversion: 6 */ // ==UserScript== // @name PythonAnyDark // @namespace http://tampermonkey.net/ // @version 1.1 // @description Darkmode for PythonAnywhere dashboard // @author Swee // @match *://www.pythonanywhere.com/* // @grant none // @run-at document-body // ==/UserScript== const style = document.createElement("style"); style.innerHTML = ` body, .primary-navbar .active a, .navbar, .ui-dialog { background: #0f161c !important; color: white !important; } .ui-widget-content, .ui-dialog-title, .dashboard-panel__headline a, .text-muted, h1 small { color: white; } input, .form-control, .splitter-bar, .splitter-pane, .active li { background: black; color: white; } .ui-state-default, .ui-widget-content .ui-state-default { background: black; color: white; } .ui-dialog-titlebar-close { background: red !important; border-radius: 100%; border-width: 0px; color: white; } .ui-icon-closethick { display: none; } .ui-widget-header { background: none; border: none; } .btn, .btn-default, table, .table-striped>tbody>tr:nth-of-type(odd) { background: #0f161c !important; } .well { background: black !important; } .alert-warning { background: #2b1500; } tr.hoverable:hover { background: #013e6d !important; } .pale, i.pale, .directory_listing_table { color: white !important; opacity: 1; } /* Pricing */ .beginner_pane, .pricing_table ul.Free li:nth-child(2), .pricing_table ul.Free li.pricing_button { background: black; border: solid; border-color: orange; border-width: 1px; } .pricing_table ul { background: none; } ul.Free li:first-child { background: #2b1500; } .pricing_table ul li:nth-child(2), .pricing_table ul li, .pricing_table ul li, .pricing_pane { background: black; } .modal-content { background: #0f161c !important; } .close { color: white; opacity: 1; } .ui-slider { background: black; } /* home */ .jumbotron { background-color: #00457d; } ho#id_develop_anywhere_details { background-color: #434343; } `; document.head.appendChild(style); // Totally didn't take this code from Stack Overflow :3 function waitForElm(selector) { return new Promise(resolve => { if (document.querySelector(selector)) { return resolve(document.querySelector(selector)); } const observer = new MutationObserver(mutations => { if (document.querySelector(selector)) { observer.disconnect(); resolve(document.querySelector(selector)); } }); // If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336 observer.observe(document.body, { childList: true, subtree: true }); }); } waitForElm('.ace_gutter').then((elm) => { // Set the theme of Ace Editor Anywhere.Editor.editor.setOption("theme", "ace/theme/tomorrow_night"); });