You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

colord

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

plugins/lab.d.ts

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### 1.2.0
- New plugin: CIE LAB color space
### 1.1.1

@@ -2,0 +6,0 @@

{
"name": "colord",
"version": "1.1.1",
"version": "1.2.0",
"description": "👑 A tiny yet powerful tool for high-performance color manipulations and conversions",

@@ -115,2 +115,6 @@ "keywords": [

{
"path": "dist/plugins/lab.mjs",
"limit": "1 KB"
},
{
"path": "dist/plugins/names.mjs",

@@ -117,0 +121,0 @@ "limit": "1.5 KB"

@@ -85,2 +85,3 @@ <div align="center">

- HWB objects ([via plugin](#plugins))
- LAB objects ([via plugin](#plugins))
- XYZ objects ([via plugin](#plugins))

@@ -227,2 +228,19 @@ - LCH (coming soon)

<details>
<summary><b><code>toLab()</code></b> (<b>lab</b> plugin)</summary>
Converts a color to [CIE LAB](https://en.wikipedia.org/wiki/CIELAB_color_space) color space. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code).
```js
import { colord, extend } from "colord";
import labPlugin from "colord/plugins/lab";
extend([labPlugin]);
colord("#ffffff").toLab(); // { l: 100, a: 0, b: 0, alpha: 1 }
colord("#33221180").toLab(); // { l: 14.89, a: 5.77, b: 14.41, alpha: 0.5 }
```
</details>
<details>
<summary><b><code>toXyz()</code></b> (<b>xyz</b> plugin)</summary>

@@ -478,5 +496,5 @@

<details>
<summary><b><code>hwb</code> (Hue-Whiteness-Blackness color model)</b> <i>0.5 KB</i></summary>
<summary><b><code>hwb</code> (HWB color model)</b> <i>0.5 KB</i></summary>
Adds support of [HWB (Hue-Whiteness-Blackness)](https://en.wikipedia.org/wiki/HWB_color_model) color model.
Adds support of [Hue-Whiteness-Blackness](https://en.wikipedia.org/wiki/HWB_color_model) color model.

@@ -499,2 +517,19 @@ ```js

<details>
<summary><b><code>lab</code> (CIE LAB color space)</b> <i>0.78 KB</i></summary>
Adds support of [CIE LAB](https://en.wikipedia.org/wiki/CIELAB_color_space) color model. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code).
```js
import { colord, extend } from "colord";
import labPlugin from "colord/plugins/lab";
extend([labPlugin]);
colord({ l: 53.24, a: 80.09, b: 67.2 }).toHex(); // "#ff0000"
colord("#ffffff").toLab(); // { l: 100, a: 0, b: 0, alpha: 1 }
```
</details>
<details>
<summary><b><code>names</code> (CSS color keywords)</b> <i>1.29 KB</i></summary>

@@ -568,5 +603,5 @@

- [x] [HWB](https://drafts.csswg.org/css-color/#the-hwb-notation) color space (via plugin)
- [ ] [LAB](https://www.w3.org/TR/css-color-4/#resolving-lab-lch-values) color space (via plugin)
- [x] [LAB](https://www.w3.org/TR/css-color-4/#resolving-lab-lch-values) color space (via plugin)
- [ ] [LCH](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) color space (via plugin)
- [ ] CMYK color space (via plugin)
- [ ] Mix colors (via plugin)

@@ -26,2 +26,7 @@ export declare type RgbColor = {

}
export interface LabColor {
l: number;
a: number;
b: number;
}
declare type WithAlpha<O> = O & {

@@ -35,3 +40,6 @@ a: number;

export declare type XyzaColor = WithAlpha<XyzColor>;
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor;
export declare type LabaColor = LabColor & {
alpha: number;
};
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor;
export declare type AnyColor = string | ObjectColor;

@@ -38,0 +46,0 @@ export declare type InputObject = Record<string, unknown>;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc