first commit
This commit is contained in:
32
docs/media/image/colour-convert-cieluv/README.md
Normal file
32
docs/media/image/colour-convert-cieluv/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# @suaveplan/colour-convert-cieluv - CIELUV, xyY, LMS, and Bradford chromatic adaptation for professional colour workflows
|
||||
|
||||
CIELUV, xyY, LMS, and Bradford chromatic adaptation conversions. This plugin provides colour-space transforms between RGB, CIELUV, xyY, and LMS cone-response space, including Bradford adaptation across 11 standard illuminants (A, B, C, D50/55/65/75, E, F2/F7/F11).
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
## Documentation tree
|
||||
|
||||
- [colour-convert-cieluv](./src/colour-convert-cieluv/colour-convert-cieluv.md) — `colour-convert-cieluv.ts` extends the CIE colour family with CIELUV, xyY chromaticity, LMS cone response, and Bradford…
|
||||
- [colour-convert-cieluv](./src/colour-convert-cieluv/colour-convert-cieluv.md) — `colour-convert-cieluv.ts` extends the CIE colour family with CIELUV, xyY chromaticity, LMS cone response, and Bradford…
|
||||
<!-- end:auto-docs -->
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
bun add @suaveplan/colour-convert-cieluv
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```ts
|
||||
import { rgbToLuv, bradfordAdapt } from "@suaveplan/colour-convert-cieluv";
|
||||
|
||||
const luv = rgbToLuv({ r: 128, g: 64, b: 32 });
|
||||
console.log(luv); // { l: ~32.9, u: ~40.6, v: ~37.8 }
|
||||
|
||||
const d50 = bradfordAdapt({ x: 50, y: 50, z: 50 }, "D65", "D50");
|
||||
console.log(d50); // { x: ~52.9, y: ~50, z: ~37.7 }
|
||||
```
|
||||
|
||||
## Modules
|
||||
|
||||
- [`src/colour-convert-cieluv/colour-convert-cieluv.md`](./src/colour-convert-cieluv/colour-convert-cieluv.md) — CIELUV, xyY, LMS, and Bradford adaptation implementation
|
||||
@@ -0,0 +1,67 @@
|
||||
# colour-convert-cieluv
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
_(no submodules)_
|
||||
<!-- end:auto-docs -->
|
||||
|
||||
## Purpose
|
||||
|
||||
`colour-convert-cieluv.ts` extends the CIE colour family with CIELUV, xyY chromaticity, LMS cone response, and Bradford chromatic adaptation. These spaces are essential for professional colour workflows including display calibration, print proofing, and cross-media colour reproduction.
|
||||
|
||||
## Features
|
||||
|
||||
- RGB ↔ CIELUV conversions
|
||||
- XYZ ↔ xyY conversions
|
||||
- XYZ ↔ LMS cone response conversions
|
||||
- Bradford chromatic adaptation with CIE standard illuminants
|
||||
|
||||
## Usage: Basic Example
|
||||
|
||||
```ts
|
||||
import { rgbToLuv, luvToRgb } from "@suaveplan/colour-convert-cieluv";
|
||||
|
||||
const luv = rgbToLuv({ r: 128, g: 64, b: 32 });
|
||||
const back = luvToRgb(luv);
|
||||
```
|
||||
|
||||
## Usage: Advanced Example
|
||||
|
||||
```ts
|
||||
import { bradfordAdapt, ILLUMINANTS } from "@suaveplan/colour-convert-cieluv";
|
||||
|
||||
const d50 = bradfordAdapt(xyz, "D65", "D50");
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### CIELUV
|
||||
|
||||
- `xyzToLuv(xyz: XYZ): LUV`
|
||||
- `luvToXyz(luv: LUV): XYZ`
|
||||
- `rgbToLuv(rgb: RGB): LUV`
|
||||
- `luvToRgb(luv: LUV): RGBA`
|
||||
|
||||
### xyY
|
||||
|
||||
- `xyzToxyY(xyz: XYZ): xyY`
|
||||
- `xyYToXyz(xy: xyY): XYZ`
|
||||
- `rgbToxyY(rgb: RGB): xyY`
|
||||
- `xyYToRgb(xy: xyY): RGBA`
|
||||
|
||||
### LMS
|
||||
|
||||
- `xyzToLms(xyz: XYZ): LMS`
|
||||
- `lmsToXyz(lms: LMS): XYZ`
|
||||
- `rgbToLms(rgb: RGB): LMS`
|
||||
- `lmsToRgb(lms: LMS): RGBA`
|
||||
|
||||
### Bradford Adaptation
|
||||
|
||||
- `bradfordAdapt(xyz: XYZ, source: string | XYZ, dest: string | XYZ): XYZ`
|
||||
- `ILLUMINANTS` — map of CIE standard illuminants
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
Bradford adaptation uses the standard CIECAM02 matrix and its inverse. The implementation accepts either named illuminant strings (A, B, C, D50, D55, D65, D75, E, F2, F7, F11) or raw XYZ values for custom white points. All conversion pipelines are deterministic and side-effect-free.
|
||||
|
||||
The CIELUV implementation follows the standard CIE 1976 formula with D65 as the default reference white. Internal helper functions handle the low-luminance linear branch automatically, ensuring accurate results even for very dark colours. The module has no runtime dependencies beyond the base `@suaveplan/colours` types.
|
||||
Reference in New Issue
Block a user