Liking cljdoc? Tell your friends :D

dk.simongray.colour-coded.syntax

CSS colours, parsed from the syntax of CSS Color 4 and 5, and serialised by the rules of CSS Color 4.

The parser reads:

  • hex colours, the named colours and transparent
  • rgb(), rgba(), hsl(), hsla(), hwb(), lab(), lch(), oklab(), oklch() and color(), in the modern syntax and the legacy one with commas, with none for a missing component
  • color-mix(), of any number of colours

It doesn't read relative colours, calc() or system colours. https://www.w3.org/TR/css-color-4/ https://www.w3.org/TR/css-color-5/#color-mix

CSS colours, parsed from the syntax of CSS Color 4 and 5, and serialised
by the rules of CSS Color 4.

The parser reads:

- hex colours, the named colours and transparent
- rgb(), rgba(), hsl(), hsla(), hwb(), lab(), lch(), oklab(), oklch()
  and color(), in the modern syntax and the legacy one with commas, with
  none for a missing component
- color-mix(), of any number of colours

It doesn't read relative colours, calc() or system colours.
https://www.w3.org/TR/css-color-4/
https://www.w3.org/TR/css-color-5/#color-mix
raw docstring

angle-unitsclj/s

The degrees in each unit of a CSS angle.

The degrees in each unit of a CSS angle.
sourceraw docstring

color-spacesclj/s

The spaces that color() names, by the names it gives them.

The spaces that color() names, by the names it gives them.
sourceraw docstring

component-patternclj/s

The syntax of a component of a colour function: a CSS number, and its unit or percent sign, if any.

The syntax of a component of a colour function: a CSS number, and its
unit or percent sign, if any.
sourceraw docstring

format-numberclj/s

(format-number x)
(format-number x digits)

The number x as a CSS number, rounded to digits significant digits, by default 6, without trailing zeros, and the same on every platform.

The number `x` as a CSS number, rounded to `digits` significant digits,
by default 6, without trailing zeros, and the same on every platform.
sourceraw docstring

functionsclj/s

The spec of each colour function of CSS, by its name: the space of its colours, and the specs of its components and its alpha, for component to read.

The spec of each colour function of CSS, by its name: the space of its
colours, and the specs of its components and its alpha, for component to
read.
sourceraw docstring

mix-spacesclj/s

The spaces that color-mix() interpolates in, by the names it gives them.

The spaces that color-mix() interpolates in, by the names it gives
them.
sourceraw docstring

named-coloursclj/s

The named colours of CSS Color 4, as hex colours, by their names.

The named colours of CSS Color 4, as hex colours, by their names.
sourceraw docstring

parseclj/s

(parse s)

The colour of the CSS colour s, e.g. "#24476b", "rebeccapurple" or "oklch(44% 0.085 158)", as a map of its :space, :coords and :alpha, or nil when the parser can't read it.

The colour of the CSS colour `s`, e.g. "#24476b", "rebeccapurple" or
"oklch(44% 0.085 158)", as a map of its :space, :coords and :alpha, or
nil when the parser can't read it.
sourceraw docstring

parse-hexclj/s

(parse-hex s)

The colour of the CSS hex colour s, e.g. #24476b, #fff or #ffffff80, as an sRGB colour, or nil when it isn't one.

The colour of the CSS hex colour `s`, e.g. #24476b, #fff or #ffffff80, as
an sRGB colour, or nil when it isn't one.
sourceraw docstring

serialiseclj/s

(serialise {:keys [coords alpha] :as colour})

The colour, a map of its :space, :coords and :alpha, as CSS:

  • sRGB, HSL and HWB as rgb() or rgba(), the legacy form, unless a component is missing
  • Lab, LCH, Oklab and OKLCH as their own functions
  • the rest as color()
The `colour`, a map of its :space, :coords and :alpha, as CSS:

- sRGB, HSL and HWB as rgb() or rgba(), the legacy form, unless a
  component is missing
- Lab, LCH, Oklab and OKLCH as their own functions
- the rest as color()
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close