Brightness inversion
Say you have a color
- intuitively, would like to reflect across the plane
, but that maps some colors outside of (e.g. pure red wants to go to ) - Obsidian’s Minimal theme does it by
- first inverting colors completely
(which changes the hue diametrically) - then rotating the hue
- first inverting colors completely
- but rotating the hue doesn’t preserve overall brightness
(much less the perceived brightness), since hue is actually (see File:Hsl-and-hsv.svg - Wikimedia Commons)
Solution on Chrome
To replace in Invert! Chrome extension’s on.js
file (to find it, use “Option 3: View source of locally installed extension” here)
if (document.getElementById("invertRunning") == null) {
var style = document.createElement("style");
style.type = "text/css";
style.id = "invertRunning";
document.head.appendChild(style);
}
document.getElementById("invertRunning").innerHTML = "html {-webkit-filter: brightness(85%) invert(100%) hue-rotate(180deg); background: white}";
- The
brightness(85%)
part is optional; it makes sure the background is not pitch black post-inversion. - The
background: white
part sets the default background color of the non-inverted version to be white, just in case that wasn’t set anywhere (otherwise the background will remain white after inversion).
And by the way off.js
can be simplified to just
document.getElementById("invertRunning").innerHTML = "";
After these changes, when you click the invert button, Wikipedia looks like this:
