Skip to content

Instantly share code, notes, and snippets.

@einarmagnus
Last active June 24, 2017 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save einarmagnus/d741e30ad13b051d7971 to your computer and use it in GitHub Desktop.
Save einarmagnus/d741e30ad13b051d7971 to your computer and use it in GitHub Desktop.
When applying a dark theme to your gtk-system, Fx will use it to render form elements. This gets ugly in webpages and too often a page specifies a dark color for input elelments w/o specifying a light color for the background which makes the text invisible. This fixes those issues by always inserting default colors for form elements.
// ==UserScript==
// @name bright forms
// @namespace einar
// @description Make all form elements default to light style to combat gtk theme
// @include *
// @version 1
// @grant none
// ==/UserScript==
function addDefaultCssRules(rule) {
var styleElement = document.createElement('style');
styleElement.type = 'text/css';
document.head.insertBefore(styleElement, document.head.firstChild);
styleElement.sheet.insertRule(rule, 0);
}
addDefaultCssRules('input, button, textarea, select { background-color:#fff;border-radius:5px;color:#111 }');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment