Skip to content

Releases: gilbarbara/colorizr

5.0.1

14 Apr 18:59
98c7467

Choose a tag to compare

Internals

  • Normalized color space matrices — Renamed and reshaped all conversion constants to standard number[][] format. Fixed LSM typo → LMS. Made implicit coefficients explicit in OKLAB_TO_CLMS.
  • Fixed LMS_TO_LRGB precision — Updated to Bjorn Ottosson's published M1-inverse values (previously off by ~1e-8).
  • Extracted gamma functionssrgbGammaDecode / srgbGammaEncode extracted from inlined copies in converters and luminance.

New Exports

  • Conversion matricesLRGB_TO_LMS, LMS_TO_LRGB, OKLAB_TO_CLMS, CLMS_TO_OKLAB, SRGB_TO_P3, P3_TO_SRGB, P3_TO_XYZ, XYZ_TO_SRGB
  • ScalarsDEG2RAD, RAD2DEG, GAMUT_EPSILON, PRECISION
  • FunctionssrgbGammaDecode, srgbGammaEncode, isInGamut, oklabToLinearSRGB, oklabToLinearP3

Docs

  • New Constants and Helpers pages under an "Exports" section
  • New recipe: Build a P3-aware HSV color picker

Commits

  • Normalize color space constants and extract gamma functions: 2a6b4a5
  • Export color space constants, helper functions, and gamut check: 27b8dbe

5.0.0

13 Apr 16:31
0f4b754

Choose a tag to compare

This release aligns colorizr with the CSS Color Level 4 specification. Internal color math now operates at full float precision, converters produce spec-compliant values, and new perceptually uniform tools — gamut mapping, Delta E, and configurable interpolation spaces — make the library suitable for modern color workflows.

The API surface has been cleaned up to reflect this shift: naming is more consistent, key functions accept shorthand parameters, and legacy utilities that didn't fit the new model have been removed.

Removed

  • readableColorAPCA — Function and ReadableColorAPCAOptions type removed.
  • hexadecimalToNumber — No longer exported.
  • Colors — Type removed.

Renamed

Before After
convert(input, format) convertCSS(input, format)
getOkLCHMaxChroma(input, precision) getP3MaxChroma(input, precision)

Changed Signatures

scheme

The type option has been renamed to scheme:

// Before
scheme('#f00', { type: 'analogous' })

// After
scheme('#f00', { scheme: 'analogous' })

palette

Now accepts a format shorthand. The type: 'monochromatic' option is replaced by a monochromatic boolean:

// Before
palette('#f00', { type: 'monochromatic', format: 'hsl' })

// After
palette('#f00', { monochromatic: true, format: 'hsl' })

// Shorthand
palette('#f00', 'hsl')

mix

The fourth parameter now accepts a MixOptions object with format, hue mode, and interpolation space:

// Before
mix('#f00', '#00f', 0.5, 'hsl')

// After
mix('#f00', '#00f', 0.5, 'hsl')                          // shorthand still works
mix('#f00', '#00f', 0.5, { space: 'oklab', hue: 'longer' }) // new options

formatCSS

Second parameter now accepts a format shorthand. Output format auto-detects from the input model instead of defaulting to hex:

// Before
formatCSS({ h: 0, s: 100, l: 50 }, { format: 'hsl' })

// After
formatCSS({ h: 0, s: 100, l: 50 })        // auto-detects "hsl"
formatCSS({ h: 0, s: 100, l: 50 }, 'rgb')  // shorthand

formatHex

Now accepts strings without the # prefix:

formatHex('ff0000') // → '#ff0000'

Precision Changes

Converters now return full float precision internally. CSS string output uses 5 significant digits, matching the CSS Color Level 4 recommendation. This changes numeric output values across most conversion and manipulation functions.

New

  • deltaE(color1, color2) — Perceptual color difference using Delta E OK. Includes DELTA_E_JND constant.
  • toGamut(input, format?) — Map an out-of-gamut color into sRGB by reducing OkLCH chroma.
  • Colorizr.deltaE(input) / Colorizr.toGamut(format?) — Class methods for the above.
  • MixOptions / HueMode / ColorValue types.

Changelog

  • Upgrade dependencies: cc637a7
  • Refactor color conversion precision to match CSS Color Level 4: 6067422
  • Add "delta-e" function: b0f354f
  • Add "toGamut" function: 7f6a80c
  • Update "mix" interpolation space and hue mode: 4a91cae
  • Add internal ParsedColor to eliminate redundant parsing: 32fcd8c
  • Consolidate alpha channel handling: 086d549
  • Rename getOkLCHMaxChroma to getP3MaxChroma: 03bbe68
  • Replace "type" with "monochromatic" boolean in "palette": d95a894
  • Update formatHex to accept strings without #: bc4782f
  • Update scheme parameters: 3053b5b
  • Rename convert to convertCSS: db62265
  • Fix transparentize and opacify default format to match the input: d62faef
  • Minor fixes: cd3c537
  • Update tests to use test.each object pattern: 1565997
  • Fix formatCSS output format auto-detection and alpha: b16bd46
  • Add shorthand parameter to formatCSS, mix and palette: ce0bb16
  • Remove readableColorAPCA: 20b1d99
  • Update CI workflow: 8cf89fb
  • Update README: 0e70a5c
  • Remove demo: 84488af
  • Add docs website: 8a7fffc

4.0.1

10 Jan 20:42
4e9ecb2

Choose a tag to compare

  • Fix "scale" gamut limits: 3b1db94

4.0.0

04 Jan 23:53
8926e4c

Choose a tag to compare

  • Add getColorType function to detect CSS color types: bffd0e4
  • Refactor isValidColor to support optional color type validation: 2b8a9b5
  • Rename getP3Color to getP3MaxColor: bf7af92
  • Update "random" API: ae84ced
  • Rename "swatch" to "scale": b33e6ed
  • Rename textColor to readableColor: c492c99
  • Add "grayscale" and "mix" color functions: 6c830a3
  • Update parameter validation and error messages: ee71f97
  • Fix "palette" hue rotation: 2ed2d06
  • Update "rotate" degrees validation to enforce range: bbeb8b9
  • Add JSDoc comments for all exported functions: 47c463e
  • Update README: 642c5a7
  • Update demo: 22d99f8

Breaking changes

  • textColor → readableColor
  • swatch → scale
  • getP3Color → getP3MaxColor
  • random(type) → random(options) (use format option)
  • removed Alpha, Amount, Degrees type aliases (use number)

3.0.9

27 Dec 03:53
02bf346

Choose a tag to compare

  • Upgrade dependencies: 30db8c7
  • Code Quality improvements: 8ec091e
  • Fix color conversion to support alpha values: 528deeb
  • Add "invert" to index exports: cb330e3
  • Add support for angle units and 'none' keyword in color parsing: 7a75ff4
  • Update CI workflow: d69703f

3.0.8

11 May 01:14
33fc343

Choose a tag to compare

3.0.7

07 Jan 04:46
b2f4a86

Choose a tag to compare

  • Refactor format-css to prevent unnecessary conversions: 5019193
  • Upgrade swatch: b0cc038
  • Update tsconfig: e8a84f4

3.0.6

29 Dec 15:25
b2c9fb0

Choose a tag to compare

  • Fix husky commit hooks: d895a4d
  • Update swatch algorithm to reduce chroma compression: 54de218

3.0.5

27 Dec 17:23
9320d0e

Choose a tag to compare

  • Update swatch algorithm to handle light colors: 2a45e08

3.0.4

26 Dec 19:58
666e1ad

Choose a tag to compare