Skip to content

Instantly share code, notes, and snippets.

@Hornwitser
Last active June 13, 2018 12:50
Show Gist options
  • Save Hornwitser/2cae2a970bd0cc1df662c3bd9877c027 to your computer and use it in GitHub Desktop.
Save Hornwitser/2cae2a970bd0cc1df662c3bd9877c027 to your computer and use it in GitHub Desktop.
Dark Python 3 docs greasemonkey script
// ==UserScript==
// @name Dark Python 3
// @namespace Hornwitser
// @include https://docs.python.org/3*
// @version 1
// ==/UserScript==
// This is probably missing a few uncommon elements.
var rules = [`
body, html, div.document, div.body, div.bodywrapper, div.documentwrapper, div.related {
color: #dc9;
background-color: #222;
}`,
`div.related {
border-top-color: #dc9;
}`,
`div.related:first-child {
border-bottom-color: #dc9;
}`,
`input {
border: 1px solid #dc9 !important;
color: #eee;
background: #444;
}`,
`select {
color: #dc9;
background: #222;
border: 1px solid #dc9;
border-radius: 3px;
}`,
`table.docutils, table.docutils th, table.docutils td {
border-color: #333 !important;;
}`,
`table.docutils th {
background-color: #333;
}`,
`div.related {
color: #666;
}`,
`div.body a, div.related a {
color: #a44;
}`,
`div.body a:hover {
color: #c66;
}`,
`div.body a:visited {
color: #851;
}`,
`div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
color: #f3f3f3;
background-color: #222
}`,
`div.sphinxsidebar, div.sphinxsidebar a, div.sphinxsidebar ul
{
color: #eee;
background-color: #444
}`,
`div#sidebarbutton {
background: #555 !important;
color: #bbb !important;;
}`,
`div.sphinxsidebar h1, div.sphinxsidebar h2, div.sphinxsidebar h3,
div.sphinxsidebar h4, div.sphinxsidebar h5, div.sphinxsidebar h6 {
color: #eee;
background-color: #444
}`,
`div.body pre, code, .note code {
background-color: #111;
border-color: #442;
color: #bbb;
}`,
`dt:target, span.highlighted {
background-color: #332;
}`,
`.highlight .go {
color: #8aa;
}`,
`div.body pre {
border-color: #dc9;
}`,
`div.body div.seealso, div.body div.sidebar {
background: #232;
border-color: #252;
color: #797;
}`,
`div.body div.note {
background: #234;
border-color: #358;
color: #9bc;
}`,
`div.body div.warning {
background: #622;
border-color: #f66;
color: #fbb;
}`,
`table.docutils td {
background: #1a1a1a
}`,
];
var style = document.createElement('style');
document.head.appendChild(style);
style.disabled = document.location.pathname.search('/3/') != 0;
for (rule of rules) {
style.sheet.insertRule(rule, style.sheet.length);
}
var bulb = document.createElement('button');
bulb.setAttribute('style', `
position: fixed;
bottom: 10px;
right: 10px;
border: none;
background: transparent;
font-size: 1.5em;
`);
bulb.appendChild(document.createTextNode('💡'));
bulb.addEventListener('click', function() {
style.disabled = !style.disabled;
});
document.body.appendChild(bulb);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment