Releases: elchininet/ColorTranslator
Releases · elchininet/ColorTranslator
v5.0.0
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...v4.1.0
🚀 Features
- Improve overloads and types
- PR: #144 by @elchininet
🛠 Fixes
- Improve overloads and types
- PR: #144 by @elchininet
v4.0.0
🚀 Features
- Add support for lab color
- PR: #142 by @elchininet
🎲 Demo
- Add support for lab color
- PR: #142 by @elchininet
🧩 Dependencies
- Bump postcss from 8.4.25 to 8.4.31
- PR: #138 by @dependabot[bot]
- Bump @babel/traverse from 7.16.8 to 7.23.2
- PR: #139 by @dependabot[bot]
- Update dependencies
- PR: #141 by @elchininet
v3.0.2
🛠 Fixes
- Specify types for ESM module
- PR: #135 by @elchininet
🎲 Demo
- Update bundles
- PR: #133 by @elchininet
⚙️ Configuration
- Specify types for ESM module
- PR: #135 by @elchininet
- Provide to d.ts files, one for CommonJS and another for ESM
- PR: #136 by @elchininet
v3.0.1
🛠 Fixes
- Avoid double rounding in blending static methods
- PR: #132 by @elchininet
🎲 Demo
- Small changes demo page
- PR: #129 by @elchininet
🧩 Dependencies
- Remove coveralls package
- PR: #130 by @elchininet
- Update packages
- PR: #131 by @elchininet
v3.0.0
🚀 Features
- Implement full css level 4 support
- PR: #128 by @elchininet
🧩 Dependencies
- Update dependencies
- PR: #115 by @elchininet
- Bump semver from 5.7.1 to 5.7.2
- PR: #117 by @dependabot[bot]
⚙️ Configuration
- Add github sponsor button to the project
- PR: #112 by @elchininet
- Implement full css level 4 support
- PR: #128 by @elchininet
v2.0.0
🚀 Features
- Complete refactor of the library, add support to control the number of decimals
- PR: #111 by @elchininet
🛠 Fixes
- fix translation from black to cmyk format
- PR: #100 by @jeronimoek
🧩 Dependencies
- Bump ua-parser-js from 1.0.2 to 1.0.33
- PR: #103 by @dependabot[bot]
- Bump http-cache-semantics from 4.1.0 to 4.1.1
- PR: #105 by @dependabot[bot]
- Bump dns-packet from 5.3.1 to 5.4.0
- PR: #107 by @dependabot[bot]
- Bump webpack from 5.75.0 to 5.76.0
- PR: #108 by @dependabot[bot]
- Update dependencies
- PR: #109 by @elchininet
⚙️ Configuration
- Enforce no trailing spaces
- PR: #95 by @elchininet
- Lint test files
- PR: #102 by @elchininet
- Create a job to create releases
- PR: #110 by @elchininet
📦 Other
- Reformat functions, fix eslint and ts config
- PR: #94 by @jeronimoek
- Improve CSS builder module
- PR: #96 by @elchininet
- Refactor blending utilities
- PR: #97 by @elchininet
- minor reformat of helpers
- PR: #101 by @jeronimoek