One colour over another, as a browser draws a translucent colour on top of what lies behind it.
These are its sources:
The tests compare over with what ColorAide computes, in test/resources/composite.json, which dev/composite.py writes.
https://www.w3.org/TR/compositing-1/#simplealphacompositing https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover https://www.w3.org/TR/css-color-4/#alpha https://www.w3.org/WAI/standards-guidelines/act/rules/afw4f7/ https://github.com/w3c/fxtf-drafts/issues/427
One colour over another, as a browser draws a translucent colour on top of what lies behind it. These are its sources: - Compositing and Blending Level 1, for the formula: the simple alpha compositing of section 5.1, which section 9.1.4 gives again as the Porter-Duff operator source over - CSS Color 4, section 10.13, which requires that formula of a browser when it draws - the W3C's ACT rule afw4f7, Text has minimum contrast, for the default space, since the specification names none (fxtf-drafts issue 427) The tests compare over with what ColorAide computes, in test/resources/composite.json, which dev/composite.py writes. https://www.w3.org/TR/compositing-1/#simplealphacompositing https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover https://www.w3.org/TR/css-color-4/#alpha https://www.w3.org/WAI/standards-guidelines/act/rules/afw4f7/ https://github.com/w3c/fxtf-drafts/issues/427
(over a b)(over a b space)The colour a composited over b, i.e. what shows where a lies on top
of b, computed in the space, by default sRGB.
The result isn't clipped, so a colour outside the gamut of space can stay
outside it. For a polar space, e.g. :oklch, the result is nil, since the
formula averages each component, and a hue is an angle.
The specification leaves three things open, so these are judgements:
To composite several layers, reduce them from the bottom up:
(reduce #(over %2 %1) layers)
The colour `a` composited over `b`, i.e. what shows where `a` lies on top
of `b`, computed in the `space`, by default sRGB.
The result isn't clipped, so a colour outside the gamut of `space` can stay
outside it. For a polar `space`, e.g. :oklch, the result is nil, since the
formula averages each component, and a hue is an angle.
The specification leaves three things open, so these are judgements:
- sRGB as the default, with its components gamma-encoded. The W3C's ACT
rule afw4f7 puts the contrast of black at an alpha of 30% on white at
2.1. That's the result in sRGB, while in linear light it's 1.4. mix
defaults to Oklab instead, as color-mix() does.
- Components of 0 where both colours have an alpha of 0, since the formula
divides by the alpha of the result. CSS Color 4 does the same when it
interpolates two such colours (section 13.5).
- 0 for a missing component and for a missing alpha, as CSS Color 4 has it
for a colour that a browser draws (section 4.4).
To composite several layers, reduce them from the bottom up:
(reduce #(over %2 %1) layers)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |