Convert from One Colour Space to Another, Print a Ready-to-Paste Modern 'CSS' Syntax
Overview
Provides a comprehensive 'API' for colour conversion between popular colour spaces ('RGB', 'HSL', 'OKLab', 'OKLch', 'hex', and named colours) along with clean, modern 'CSS' Color Level 4 syntax output. Integrates seamlessly into 'Shiny' and 'Quarto' workflows. Includes nearest colour name lookup powered by a curated database of over 30,000 colour names. 'OKLab'/'OKLCh' colour spaces are described in Ottosson (2020) https://bottosson.github.io/posts/oklab/. 'CSS' Color Level 4 syntax follows the W3C specification https://www.w3.org/TR/css-color-4/.
CSS output accuracy
- Numeric precision increased from 3 to 4 decimal places.
- Achromatic colors (zero chroma) now use
nonefor hue, per CSS Color Level 4 spec. - Alpha omitted when equal to 1 (full opacity is the CSS default).
from_css()now parses thenonekeyword.
Fallback redesign
fallbackargument changed fromTRUE/FALSEto"all","r", or"none".fallback = "r"returns the nearest R built-in colour name (fromgrDevices::colors()).distanceargument removed from all functions. Lab distance is used internally.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-03-10
Documentation
- Help pages
- 15
- Examples that run
- 100%13 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 0
- Median days to close, 50 most recently updated closed PRs
- 0
Releases over time
6 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/iamyannc/colourspace on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.1.1Latest
- 0.0.12026-03-04
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-03-04
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5
- Bundled data
- 2.2 MB / 2 files
- Download size
- 2.3 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("colourspace")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.