Dark mode - invert color

I am sharing with you a great tip if you want some kind of dark mode where everything that is light become dark (yes, even the jpg and the jpg pasted into your excalidraw drawing!).

  • first download the plugin “Javascript Init”
  • second, in the parameter of the plugin paste the following code :

javascript:(function () { var css = ‘html {-webkit-filter: invert(100%);’ + ‘-moz-filter: invert(100%);’ + ‘-o-filter: invert(100%);’ + ‘-ms-filter: invert(100%); }’; var head = document.getElementsByTagName(‘head’)[0]; var style = document.createElement(‘style’); 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)); } head.appendChild(style);}());

  • finally, click the new button “Run Init Javascript” located on the left pane of Obsidian

Hope it helps !

1 Like