Project

General

Profile

Feature #971

Dark theme support

Added by Luke Murphey about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
02/19/2015
Due date:
% Done:

100%


inverted.png View (92.1 KB) Luke Murphey, 02/26/2015 04:08 AM

History

#1 Updated by Luke Murphey about 9 years ago

I found some information on how to do this:

This worked well for me:

invert_colors = function() { 
// the css we are going to inject
var css = 'html {-webkit-filter: invert(100%);' +
    '-moz-filter: invert(100%);' + 
    '-o-filter: invert(100%);' + 
    '-ms-filter: invert(100%); }',

head = document.getElementsByTagName('head')[0],
style = document.createElement('style');

// a hack, so you can "invert back" clicking the bookmarklet again
if (!window.counter) { window.counter = 1;} else  { window.counter ++;
if (window.counter % 2 == 0) { var css ='html {-webkit-filter: invert(0%); -moz-filter:    invert(0%); -o-filter: invert(0%); -ms-filter: invert(0%); }'}
 };

style.type = 'text/css';
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}

//injecting the css to the head
head.appendChild(style);
}

invert_colors();

#2 Updated by Luke Murphey about 9 years ago

Might want to hide scroll bars too since they stay white.

#3 Updated by Luke Murphey about 9 years ago

#4 Updated by Luke Murphey about 9 years ago

It looks like this isn't supported in FireFox.

#5 Updated by Luke Murphey about 9 years ago

  • Status changed from New to Closed
  • Target version set to 2.1
  • % Done changed from 0 to 100

Also available in: Atom PDF