Skip to content

Releases: color-js/color.js

v0.2.4

29 Jun 15:15
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.3...v0.2.4

v0.2.3

29 Jun 12:13
Compare
Choose a tag to compare
  • Export ColorSpace and RGBColorSpace in index-fn
  • Add src to npm package, fixes #167

Full Changelog: v0.2.2...v0.2.3

v0.2.2

28 Jun 20:26
Compare
Choose a tag to compare

Fixed two bugs:

  • Fixed regression with the fallback parameter in serialize() / color.toString()
  • Precision in serialize() / color.toString() now applies to alpha too

Full Changelog: v0.2.1...v0.2.2

v0.2.1

28 Jun 17:34
Compare
Choose a tag to compare

Fixed bug with deltaE(), see #165

v0.2.0 - Optional tree-shakeable API!

28 Jun 12:42
Compare
Choose a tag to compare

While we were hoping that the previous release would be the last one done before Color.js is "officially" released in the wild, we ended up making some more big changes before this happens, but for a very good reason.

The biggest change in this release is that all internals have been rewritten to provide an alternative API that is procedural and thus, tree-shakable. It is also faster because it can operate on plain objects instead of Color objects. You can read more about how this works in the docs. Color spaces are still not tree-shakeable, see #163.

If you prefer the OO API, you can continue using it, it is not going anywhere!

Other breaking changes

Leanness has been a focus of this release, so we removed a lot of cruft that did not make sense or was superfluous.

  • src/main.js has been renamed to src/index.js
  • defaults.gamutMapping is now defaults.gamut_mapping and we plan to generally use underscore_case for config options going forward.
  • The color.lightness, color.chroma and color.hue accessors that were previously deprecated are now removed.
  • The legacy Color.space() alias is now removed. Just use Color.Space.get().
  • Removed Color.convert(), see #153
  • Color.inGamut() is now a consistent static version of color.inGamut(). Previously it had an entirely different signature.
  • new Color("--foo" [, element]) syntax has been removed, see #160 for details.
  • new Color(coords [,alpha]) signature which assumed sRGB has been removed. Just provide the color space explicitly.
  • color.white getter has been removed. Just use color.space.white.
  • The fallback parameter in color.toString() / serialize() has been simplified to take a single color space instead of an array. Similarly, defaults.fallbackSpaces has been removed, there is now only a defaults.css_space that is set upon startup and can be overridden.

Other changes and fixes

  • New ColorSpace#to(color) signature
  • New ColorSpace#from(space, coords)/ColorSpace#from(color) method b130d02
  • ColorSpace.get() now accepts alternatives, e.g. you can do ColorSpace.get("oklch", "lch") to get oklch if available, or lch otherwise.
  • Fixed ACEScc range #157

Acknowledgements

We'd like to thank @ai for his help and encouragement wrt making Color.js tree-shakeable! (#159)

Full Changelog: v0.1.0...v0.2.0

v0.1.0 - Candidate public release

26 Jun 11:43
Compare
Choose a tag to compare

Lots of breaking changes in this release, so be careful when upgrading from v0.0.x!

  • Major refactor of the API and internals after our experience drafting a Color API for the Web Platform. The main changes are:
    • #113 Color spaces are now defined by ColorSpace objects with a base property, which creates a tree of color spaces. Conversions between spaces now use the lowest common ancestor in the tree as a connection space, eliminating the need for custom pre-computed "shortcuts" for conversions
    • #144 Breaking change: Instead of long-form coordinate names like hue, chroma, lightness, we now use shorter ones like h, c, l. The longer names are still there as metadata, which can be useful for generating UIs (such as this generic color picker for any color space!
    • #111 color.get(coordRef), color.getAll(spaceRef), color.set(coordRef, coorde), color.setAll(spaceRef, coords) for reading/setting coords in any color space. These are faster, and more flexible. The previous syntax (color.spaceId.coordId) is still available, but has been moved to a plugin and is not used internally (which should improve performance of a variety of functions).
    • Color.defineSpace() is now ColorSpace.register() (with different params)
    • Due to the way color spaces are now defined, we have added linear versions of every RGB space (and ACEScg which is the linear version of ACEScc)
  • #152 Breaking change: color.toGamut() now performs in-place modification. Clone the color first if you want the old behavior: color.clone().toGamut()
  • #145 Breaking change: color.spaceId and color.space are now immutable which helps performance
  • Breaking change: Trimmed down the API and removed methods that were hardly ever used:
    • color.getCoords({inGamut, precision})
    • util.value(), util.capitalize(), util.extend()
  • Breaking change: #147 Removed color.hue, color.chroma, color.lightness as well as Color.shortcuts that defined these. Now the color space for these needs to be explicitly defined. More details on the reasoning in #147.
  • Breaking change: #148 Default output space for interpolation is now the interpolation space instead of the first color's color space
  • CSS-like functional formats are now defined by CSS-like grammars such as ["<number> | <angle>", "<percentage>", "<percentage>"]
  • Breaking change: fallback parameter in color.toString() is now simplified to be either a boolean or a color space reference, no arrays. Color.defaults.fallbackSpaces is now removed, Color.defaults.css_color is automatically populated from a predefined list of lab, rec2020, p3, srgb based on what the current browser supports (or srgb if there no browser).
  • #155 Fixes to make Color.js usable on Node
  • Breaking change: dist/ files renamed (and their .min versions):
    • dist/color.esm.js is now dist/color.js
    • dist/color.js is now dist/color.global.js
    • dist.color.cjs.js is now dist/color.cjs
  • Also lots of other bugfixes, test fixes, demo fixes, docs fixes

Full Changelog: v0.0.7...v0.1.0

Tree of color spaces we support

v0.0.7

16 Jun 11:39
Compare
Choose a tag to compare
v0.0.7 Pre-release
Pre-release
  • BREAKING CHANGE: Named exports have been eliminated from modules that have default exports. This fixed the IIFE build (#98)
  • Fixed error in ESM build that made it depend on a global Color (#107)

Full Changelog: v0.0.6...v0.0.7

v0.0.6

16 Jun 10:26
Compare
Choose a tag to compare
v0.0.6 Pre-release
Pre-release

What's Changed

  • Parse oklch() and oklab() functional forms
  • Output oklch() and oklab() instead of color(...) for OKLCH and OKLab colors
  • Typo OKCH > OKLCH by @ai in #133
  • Move acorn to devDependencies by @ai in #131
  • Fix circular reference by @facelessuser in #138

Full Changelog: v0.0.5...v0.0.6

v0.0.5

19 Feb 16:09
Compare
Choose a tag to compare
v0.0.5 Pre-release
Pre-release

What's Changed

  • Fix DeltaEJz algorithm by @facelessuser in #90
  • [Doc][Adaptation] fix CAT example by @Ayc0 in #117
  • [Doc][Adaptation] fix XYZ example by @Ayc0 in #118
  • Reduce npm package size by @ai in #126
  • Remove .min files from npm package by @ai in #129
  • Fix .min cleaning and remove IIFE builds by @ai in #130

New Contributors

  • @Ayc0 made their first contribution in #117
  • @ai made their first contribution in #126

Full Changelog: v0.0.4...v0.0.5

v0.0.4

01 Nov 10:42
Compare
Choose a tag to compare
v0.0.4 Pre-release
Pre-release

What's Changed

  • Support for OKLab and OKLCH (color spaces) and deltaEOK (deltaE method)
  • Experimental ACEScc implementation
  • Fix typos: self -> this by @facelessuser in #61
  • chore: use conditional package.json exports by @kripod in #62
  • Fix algorithmic asymmetry by @facelessuser in #65
  • Fix HSV to HSL conversion by @facelessuser in #68
  • Fix conversion issues with HWB and HSL by @facelessuser in #79
  • Acquire luminance from XYZ D65 to match WCAG 2.0 more correctly by @facelessuser in #83
  • Fix error in Delta E algorithm by @facelessuser in #85
  • get: use the actual package name by @Artoria2e5 in #94
  • Fix comparison inconsistencies by @facelessuser in #80
  • package.json: Remove duplicate wrong "main" by @Artoria2e5 in #97
  • docs: minor non-content fixes in color-difference.md by @micgro42 in #88
  • Pass epsilon to spaces that redirect the inGamut check by @facelessuser in #73
  • Various bugfixes and improvements to the math

New Contributors

Full Changelog: v0.0.3...v0.0.4