Skip to content

Instantly share code, notes, and snippets.

@mateusvahl
Created February 26, 2016 19:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mateusvahl/fe92afc0109b5c1b9323 to your computer and use it in GitHub Desktop.
Save mateusvahl/fe92afc0109b5c1b9323 to your computer and use it in GitHub Desktop.
High Cotrast JS
function parseBackground($element) {
var css = $element.css('background-color');
if (!css || (css == 'rgba(0, 0, 0, 0)' || css == 'transparent')) {
return;
}
$element.css('background-color', 'black');
}
function parseColor($element) {
$element.css('color', 'white');
}
jQuery('body, body *:not("svg, svg *")').each(function(i, e) {
var pattern = /(rgba\(.*, 0\))/;
var $element = jQuery(this);
parseBackground($element);
parseColor($element);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment