CKTIS / CSS
sepia(): a graded brown-toned color filter
Apply a sepia conversion to the rendered image and distinguish omission, zero and values above 100%.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
filter: sepia(50%);sepia(amount) converts rendered colors toward a sepia palette. Zero leaves the input colors unchanged, 100% or 1 applies the full conversion, and intermediate values blend the effect. The omitted argument in sepia() means 1. Values above 100% are accepted but clamped to the full effect; negative values are invalid.
This is a filter on the rendered element, so it can affect its text, background and descendants together. It does not edit an image file or change the element’s layout dimensions. Combining sepia with other filters applies the list in order and can change the result. Unlike saturate(), larger accepted values do not increase this effect beyond its maximum.
The example paints an opaque RGB(80,120,160) patch and samples it through the browser’s SVG/canvas rendering path. In Chromium 157 the sampled RGBA values are 80,120,160,255 at zero, 117,129,133,255 at half and 154,137,107,255 at full strength. Empty parentheses and 200% match the full result; the negative form fails CSS.supports().
Examples
async function sample(filter) {
const svg='<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><foreignObject width="8" height="8"><div xmlns="http://www.w3.org/1999/xhtml" style="width:8px;height:8px;background:rgb(80 120 160);filter:'+filter+'"></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].join(',');
}
const normal=await sample('sepia(0)');
const half=await sample('sepia(50%)');
const full=await sample('sepia(1)');
const omitted=await sample('sepia()');
const over=await sample('sepia(200%)');
console.log('normal='+normal+'; half='+half+'; full='+full+'; omitted='+omitted+'; over='+over+'; negative='+CSS.supports('filter','sepia(-0.1)'));Result
normal=80,120,160,255; half=117,129,133,255; full=154,137,107,255; omitted=154,137,107,255; over=154,137,107,255; negative=false
These are measured pixels from the stated rendering path, not universal byte values promised for every graphics pipeline. The unchanged alpha and matching full/omitted/over-limit samples demonstrate the intended distinctions.