Skip to content


Bookmarklet: Print Background Colors

I like that idea. Here is a quick and dirty Bookmarklet that applies it to every element on a page (Webkit only):
Print Background Colors

javascript:(function() {
    var c = '*{-webkit-print-color-adjust:exact;}',
        s = document.createElement('style');
    s.type = 'text\/css';
    if (s.styleSheet) {
        s.styleSheet.cssText = c;
    } else {
        s.appendChild(document.createTextNode(c));
    }
    document.getElementsByTagName('head')[0].appendChild(s);
})();

And the minified version:

javascript:(function(){var c='*{-webkit-print-color-adjust:exact;}',s=document.createElement('style');s.type='text\/css';if(s.styleSheet){s.styleSheet.cssText=c;}else{s.appendChild(document.createTextNode(c));}document.getElementsByTagName('head')[0].appendChild(s);})();

Posted in Web Development.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.