Skip to content

Releases: elchininet/ColorTranslator

v6.0.1

02 Mar 21:54

Choose a tag to compare

This release is just a refactoring of the library. It refactors the color contexts store, converting it to a Map instead of an Object. Several types, variables and utility functions have been also refactored.


⚙️ Configuration

📦 Other

v6.0.0

01 Mar 23:22

Choose a tag to compare

This release should not represent a breaking change because the API keeps being the same, but as the library has been refactored entirely and some previous conversions have changed, it is safer to bump it to a major version.

Apart of the entire refactoring of the library, something that deduplicated a lot of functionalities and improved the color management, this new versions avoids unnecessary conversions during round trips. So, if you convert a color to the same format, the library parses the color but do not try to convert it, in its place it just formats it to match the final desired output. This fixes an issue in which some complicated color conversions, as LCH, was retuning a slightly different color during a round trip conversion.


What's Changed

  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #265
  • [Dependencies]: Bump the dependencies-dev group with 7 updates by @dependabot[bot] in #266
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #267
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #268
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #269
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #270
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #271
  • Solve a on-header vulnerability through pnpm overrides by @elchininet in #272
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #273
  • [Dependencies]: Bump the dependencies-dev group with 3 updates by @dependabot[bot] in #274
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #275
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #276
  • [Github Actions]: Bump actions/checkout from 4 to 5 in the actions-deps group by @dependabot[bot] in #277
  • Solve tmp vulnerability using a pnpm override by @elchininet in #278
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #279
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #280
  • [Dependencies]: Bump the dependencies-dev group with 7 updates by @dependabot[bot] in #281
  • [Github Actions]: Bump actions/setup-node from 4 to 5 in the actions-deps group by @dependabot[bot] in #282
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #283
  • [Dependencies]: Bump the dependencies-dev group with 7 updates by @dependabot[bot] in #284
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #285
  • [Dependencies]: Bump the dependencies-dev group with 7 updates by @dependabot[bot] in #286
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #287
  • Update browser_list db by @elchininet in #288
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #289
  • [Github Actions]: Bump actions/setup-node from 5 to 6 in the actions-deps group by @dependabot[bot] in #290
  • [Dependencies]: Bump the dependencies-dev group with 3 updates by @dependabot[bot] in #291
  • Remove classic token configuration from deploy workflow by @elchininet in #292
  • Update npm before publishing a new version by @elchininet in #293
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #294
  • [Github Actions]: Bump mikepenz/release-changelog-builder-action from 5 to 6 in the actions-deps group by @dependabot[bot] in #295
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #296
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #297
  • Solve vulnerabilities through pnpm overrides by @elchininet in #298
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #299
  • [Github Actions]: Bump actions/checkout from 5 to 6 in the actions-deps group by @dependabot[bot] in #300
  • [Dependencies]: Bump typescript-eslint from 8.47.0 to 8.48.0 in the dependencies-dev group by @dependabot[bot] in #301
  • [Dependencies]: Bump the dependencies-dev group with 2 updates by @dependabot[bot] in #302
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #303
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #304
  • [Dependencies]: Bump typescript-eslint from 8.50.0 to 8.50.1 in the dependencies-dev group by @dependabot[bot] in #305
  • Solve vulnerabilities through pnpm overrides by @elchininet in #306
  • [Dependencies]: Bump the dependencies-dev group with 2 updates by @dependabot[bot] in #307
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #308
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #309
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #310
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #311
  • Solve vulnerabilities through pnpm overrides by @elchininet in #312
  • [Dependencies]: Bump the dependencies-dev group with 4 updates by @dependabot[bot] in #313
  • [Dependencies]: Bump the dependencies-dev group with 3 updates by @dependabot[bot] in #314
  • [Dependencies]: Bump the dependencies-dev group with 6 updates by @dependabot[bot] in #315
  • [Dependencies]: Bump the dependencies-dev group with 5 updates by @dependabot[bot] in #317
  • Complete refactoring of the library and fix round trip conversion by @elchininet in #318

Full Changelog: v5.0.0...v6.0.0

v5.0.0

05 Jun 22:58

Choose a tag to compare

This release is a major update of the library and it brings new features and solve some minor bugs.

New features

Support from HWB colors

HWB colors are now supported in the library.

CSS string inputs

Example of CSS string inputs Description
hwb(0 0% 0%) Functional HWB notation
hwb(0 0% 0% / 0.5) Functional HWB notation with alpha
hwb(0deg 0% 0%) Functional HWB notation with hue in degrees
hwb(0grad 0% 0%) Functional HWB notation with hue in gradians
hwb(0rad 0% 0%) Functional HWB notation with hue in radians
hwb(0turn 0% 0%) Functional HWB notation with hue in turns

Object inputs

Example of object inputs Description
{H: 0, W: 0, B: 0} HWB notation
{H: 0, W: 0, B: 0, A: 0.5} HWB notation with alpha

Class public methods

Public methods Input Description
setWhiteness 0 ≤ input ≤ 100 Sets the color whiteness percentage
setBlackness 0 ≤ input ≤ 100 Sets the color blackness percentage

Class public readonly properties

Property Description
HWB Gets the css hwb representation of the color
HWBA Gets the css hwb representation of the color with alpha
HWBObject Gets the object HWB representation of the color
HWBAObject Gets the object HWB representation of the color with alpha
Whiteness Gets the color whiteness percentage
Blackness Gets the color blackness percentage

Color conversion static methods description

Static method Description
toHWB Converts to an hwb notation
toHWBObject Converts to an object in hwb notation
toHWBA Converts to an hwb notation with alpha
toHWBAObject Converts to an object in hwb notation with alpha
getBlendHWB Creates an array relative to the blend between two colors in hwb notation
getBlendHWBObject Creates an array of objects relative to the blend between two colors in hwb notation
getBlendHWBA Creates an array relative to the blend between two colors in hwb notation with alpha
getBlendHWBAObject Creates an array of objects relative to the blend between two colors in hwb notation with alpha
getMixHWB Gets the mix of the input colors in hwb notation
getMixHWBObject Gets the mix of the input colors in an object in hwb notation
getMixHWBA Gets the mix of the input colors in hwb notation with alpha
getMixHWBAObject Gets the mix of the input colors in an object in hwb notation with alpha

Support from LCH colors

LCH colors are now supported in the library.

Example of CSS string inputs Description
lch(54 107 41) Functional LCH notation
lch(54% 71% 41) Functional LCH notation with percentages
lch(54 107 41 / 0.5) Functional LCH notation with alpha
lch(54% 71% 41 / 0.5) Functional LCH notation with percentages and alpha
lch(54 107 41deg) Functional LCH notation with hue in degrees
lch(54 107 46grad) Functional LCH notation with hue in gradians
lch(54 107 1rad) Functional LCH notation with hue in radians
lch(54 107 0turn) Functional LCH notation with hue in turns

Object inputs

Example of object inputs Description
{L: 54, C: 107, H: 41} LCH notation
{L: 54, C: 107, H: 41, A: 0.5} LCH notation with alpha

Class public methods

Public methods Input Description
setLCHL 0 ≤ input ≤ 100 Sets the color lightness percentage
setLCHC 0 ≤ input ≤ 150 Sets the color chroma
setLCHH 0 ≤ input ≤ 360 Sets the lch color hue

Class public readonly properties

Property Description
LCH Gets the css lch representation of the color
LCHA Gets the css lch representation of the color with alpha
LCHObject Gets the object lch representation of the color
LCHAObject Gets the object lch representation of the color with alpha
LCHL Gets the lch color lightness
LCHC Gets the color chroma
LCHH Gets the lch color hue

Color conversion static methods description

Static method Description
toLCH Converts to a lch notation
toLCHObject Converts to an object in lch notation
toLCHA Converts to a lch notation with alpha
toLCHAObject Converts to an object in lch notation with alpha
getBlendLCH Creates an array relative to the blend between two colors in lch notation
getBlendLCHObject Creates an array of objects relative to the blend between two colors in lch notation
getBlendLCHA Creates an array relative to the blend between two colors in lch notation with alpha
getBlendLCHAObject Creates an array of objects relative to the blend between two colors in lch notation with alpha
getMixLCH Gets the mix of the input colors in lch notation
getMixLCHObject Gets the mix of the input colors in an object in lch notation
getMixLCHA Gets the mix of the input colors in lch notation with alpha
getMixLCHAObject Gets the mix of the input colors in an object in lch notation with alpha

Support from relative colors

Relative colors colors are now supported in the library as CSS input.

CSS string inputs

Example of CSS string inputs Description
rgb(from #F00 r g b) Functional RGB notation in relative color syntax
rgb(from hsl(0 100% 50%) calc(r + 5) g b / calc(alpha / 2)) Functional RGB notation in relative color syntax with alpha
hsl(from hsl(0 100 50) h s l) Functional HSL notation in relative color syntax
hsl(from hsl(0 100 50) calc(h + 5) s l / calc(alpha / 2)) Functional HSL notation in relative color syntax with alpha
hwb(from hwb(0 0% 0%) h w b) Functional HWB notation in relative color syntax
hwb(from hwb(0 0% 0%) calc(h + 2) w b / calc(alpha / 2)) Functional HWB notation in relative color syntax with alpha
lab(from #F00 l a b) Functional LAB notation in relative color syntax
lab(from #F00 calc(l + 5) a b / calc(alpha / 2)) Functional LAB notation in relative color syntax with alpha
lch(from lch(54 107 41) l c h) Functional LCH notation in relative color syntax
lch(from lch(54 107 41) calc(l + 2) c h / calc(alpha / 2)) Functional LCH notation in relative color syntax and alpha

Example:

const color = new ColorTranslator('#F0...
Read more

v4.1.0

27 Nov 21:19

Choose a tag to compare

🚀 Features

🛠 Fixes

v4.0.0

26 Nov 22:45

Choose a tag to compare

🚀 Features

🎲 Demo

🧩 Dependencies

v3.0.2

02 Aug 17:47

Choose a tag to compare

🛠 Fixes

🎲 Demo

⚙️ Configuration

v3.0.1

20 Jul 21:29

Choose a tag to compare

🛠 Fixes

🎲 Demo

🧩 Dependencies

v3.0.0

18 Jul 00:01

Choose a tag to compare

⚠️⚠️⚠️ BREAKING CHANGE!!! ⚠️⚠️⚠️
⚠️⚠️⚠️ BEFORE UPGRADE CONSULT THE README.md TO SEE THE LATEST CHANGES AND CHECK IF THEY CAN AFFECT YOU ⚠️⚠️⚠️

🚀 Features

🧩 Dependencies

⚙️ Configuration

v2.0.0

18 May 18:04

Choose a tag to compare

🚀 Features

  • Complete refactor of the library, add support to control the number of decimals

🛠 Fixes

🧩 Dependencies

⚙️ Configuration

📦 Other