Colours between colours, interpolated by the rules that CSS Color 4 gives gradients and color-mix():
A gradient through several colours places its stops as CSS Images 3 does, in sections 3.4.2 and 3.4.3.
https://www.w3.org/TR/css-color-4/#interpolation https://www.w3.org/TR/css-images-3/#color-stop-fixup
Colours between colours, interpolated by the rules that CSS Color 4 gives gradients and color-mix(): - in Oklab, unless a space is given - with premultiplied alpha - with a missing component taken from the other colour - with a hue that turns the shorter way round, unless a method says otherwise A gradient through several colours places its stops as CSS Images 3 does, in sections 3.4.2 and 3.4.3. https://www.w3.org/TR/css-color-4/#interpolation https://www.w3.org/TR/css-images-3/#color-stop-fixup
(gradient xs)(gradient xs space)(gradient xs space hue-method)A function that takes a position from 0 to 1 and returns the colour there
on a gradient through the colours xs, interpolated in the space, by
default Oklab, with the hue-method of interpolate.
The colours are the stops of a CSS gradient, each a colour or a pair of a colour and its position, e.g. ["white" 0.2]. CSS's rules place them:
A browser draws a gradient in sRGB when every colour is written as a hex colour, a name, rgb(), hsl() or hwb(), so pass :srgb to match it.
((gradient ["red" ["white" 0.2] "blue"] :srgb) 0.1)
;; as linear-gradient(red, white 20%, blue), a tenth of the way along
A function that takes a position from 0 to 1 and returns the colour there
on a gradient through the colours `xs`, interpolated in the `space`, by
default Oklab, with the `hue-method` of interpolate.
The colours are the stops of a CSS gradient, each a colour or a pair of a
colour and its position, e.g. ["white" 0.2]. CSS's rules place them:
- the first stop is at 0 and the last at 1, unless they have a position
- a stop before an earlier one moves up to it
- the rest are spaced evenly between their neighbours
- the colour changes at once where two stops share a position
- before the first stop and after the last, the colour is theirs
A browser draws a gradient in sRGB when every colour is written as a hex
colour, a name, rgb(), hsl() or hwb(), so pass :srgb to match it.
((gradient ["red" ["white" 0.2] "blue"] :srgb) 0.1)
;; as linear-gradient(red, white 20%, blue), a tenth of the way along(gradient-steps xs n)(gradient-steps xs n space)(gradient-steps xs n space hue-method)The n colours evenly spaced along the gradient through the colours xs,
both ends included, in the space and with the hue-method of gradient.
The `n` colours evenly spaced along the gradient through the colours `xs`, both ends included, in the `space` and with the `hue-method` of gradient.
The ways that a hue can turn from one colour to another, by CSS Color 4.
The ways that a hue can turn from one colour to another, by CSS Color 4.
(interpolate a b)(interpolate a b space)(interpolate a b space hue-method)A function that takes a progress from 0 to 1 and returns the colour that
far from the colour a to b. It interpolates in the space, by default
Oklab, and turns a hue by the hue-method, one of hue-methods, by default
:shorter.
A function that takes a progress from 0 to 1 and returns the colour that far from the colour `a` to `b`. It interpolates in the `space`, by default Oklab, and turns a hue by the `hue-method`, one of hue-methods, by default :shorter.
(mix a b)(mix a b p)(mix a b p space)(mix a b p space hue-method)The colour p of the way from the colour a to b, where p runs from 0
to 1 and is by default 0.5. It interpolates in the space, by default Oklab,
with the hue-method of interpolate. It's color-mix(in space, a, b p) with p
as a percentage.
The colour `p` of the way from the colour `a` to `b`, where `p` runs from 0 to 1 and is by default 0.5. It interpolates in the `space`, by default Oklab, with the `hue-method` of interpolate. It's color-mix(in space, a, b p) with p as a percentage.
(steps a b n)(steps a b n space)(steps a b n space hue-method)The n colours evenly spaced from the colour a to b, both included,
interpolated in the space, by default Oklab, with the hue-method of
interpolate.
The `n` colours evenly spaced from the colour `a` to `b`, both included, interpolated in the `space`, by default Oklab, with the `hue-method` of interpolate.
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 |