CKTIS / CSS
invert(): invert rendered color channels
Blend rendered RGB channels with their inverses without changing the underlying content.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
filter: invert(50%);invert() is a filter function. At 0 or 0% it leaves the image unchanged; at 1 or 100% it fully inverts the color channels. Intermediate values blend those endpoints, so 50% moves the channels toward middle gray rather than producing a half-transparent image. Omitting the argument uses 100%. Values above 100% are clamped; negative arguments are invalid.
Place the function in filter, where it operates on the element's rendered image. It does not rewrite the source image, the text, or the original CSS color declarations. Filter order matters when several functions are composed. Inverting a whole interface also inverts photographs and brand colors, so it is not automatically an appropriate replacement for an intentionally designed dark theme.
The example rasterizes a solid RGB color 10,20,30. Full inversion produces 245,235,225, and an argument above 100% gives the same clamped result. The midpoint is reported as 127,127,127 by this rasterizer. That exact byte result includes rasterization rounding; the conceptual midpoint is halfway along the color-channel range.
Examples
const sample=async style=>{const svg='<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><rect width="8" height="8" fill="white"/><foreignObject width="8" height="8"><div xmlns="http://www.w3.org/1999/xhtml" style="width:8px;height:8px;'+style.replaceAll('&','&').replaceAll('"','"')+'"></div></foreignObject></svg>';const image=new Image();image.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svg);await image.decode();const canvas=document.createElement('canvas');canvas.width=canvas.height=8;const context=canvas.getContext('2d');context.drawImage(image,0,0);return [...context.getImageData(4,4,1,1).data].slice(0,3).join(',')};
const normal=await sample('background:rgb(10 20 30);filter:invert(0)');
const half=await sample('background:rgb(10 20 30);filter:invert(50%)');
const full=await sample('background:rgb(10 20 30);filter:invert(1)');
const over=await sample('background:rgb(10 20 30);filter:invert(200%)');
console.log('normal='+normal+'; half='+half+'; full='+full+'; over='+over+'; negative='+CSS.supports('filter','invert(-1)'));Result
normal=10,20,30; half=127,127,127; full=245,235,225; over=245,235,225; negative=false
The negative-value support check is false. The half-strength pixel shows channel blending, not reduced alpha.