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

colord - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

plugins/cmyk.d.ts

12

CHANGELOG.md

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

### 2.2.0
- New plugin: CMYK color space ❤️ [@EricRovell](https://github.com/EricRovell)
### 2.1.0

@@ -54,4 +58,4 @@

- Fix: Do not treat 7-digit hex as a valid color ❤️ @subzey
- Parser update: Turn NaN input values into valid numbers ❤️ @subzey
- Fix: Do not treat 7-digit hex as a valid color ❤️ [@subzey](https://github.com/subzey)
- Parser update: Turn NaN input values into valid numbers ❤️ [@subzey](https://github.com/subzey)

@@ -76,3 +80,3 @@ ### 1.2.0

- Sort named colors dictionary for better compression ❤️ @subzey
- Sort named colors dictionary for better compression ❤️ [@subzey](https://github.com/subzey)

@@ -114,3 +118,3 @@ ### 0.10.1

- 20% speed improvement ❤️ @jeetiss
- 20% speed improvement ❤️ [@jeetiss](https://github.com/jeetiss)

@@ -117,0 +121,0 @@ ### 0.6.1

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

@@ -21,2 +21,3 @@ "keywords": [

"a11y",
"cmyk",
"mix"

@@ -41,2 +42,7 @@ ],

},
"./plugins/cmyk": {
"import": "./plugins/cmyk.mjs",
"require": "./plugins/cmyk.js",
"default": "./plugins/cmyk.mjs"
},
"./plugins/hwb": {

@@ -146,2 +152,6 @@ "import": "./plugins/hwb.mjs",

{
"path": "dist/plugins/cmyk.mjs",
"limit": "1 KB"
},
{
"path": "dist/plugins/hwb.mjs",

@@ -148,0 +158,0 @@ "limit": "1 KB"

@@ -232,2 +232,38 @@ <div align="center">

<details>
<summary><b><code>.toCmyk()</code></b> (<b>cmyk</b> plugin)</summary>
Converts a color to [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model) color space.
```js
import { colord, extend } from "colord";
import cmykPlugin from "colord/plugins/cmyk";
extend([cmykPlugin]);
colord("#ffffff").toCmyk(); // { c: 0, m: 0, y: 0, k: 0, a: 1 }
colord("#555aaa").toCmyk(); // { c: 50, m: 47, y: 0, k: 33, a: 1 }
```
</details>
<details>
<summary><b><code>.toCmykString()</code></b> (<b>cmyk</b> plugin)</summary>
Converts a color to color space.
Converts a color to [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model) color space and expresses it through the [functional notation](https://www.w3.org/TR/css-color-4/#device-cmyk)
```js
import { colord, extend } from "colord";
import cmykPlugin from "colord/plugins/cmyk";
extend([cmykPlugin]);
colord("#99ffff").toCmykString(); // "device-cmyk(40% 0% 0% 0%)"
colord("#00336680").toCmykString(); // "device-cmyk(100% 50% 0% 60% / 0.5)"
```
</details>
<details>
<summary><b><code>.toHwb()</code></b> (<b>hwb</b> plugin)</summary>

@@ -642,2 +678,21 @@

<details>
<summary><b><code>cmyk</code> (CMYK color space)</b> <i>0.6 KB</i></summary>
Adds support of [CMYK](https://www.sttmedia.com/colormodel-cmyk) color model.
```js
import { colord, extend } from "colord";
import cmykPlugin from "colord/plugins/cmyk";
extend([cmykPlugin]);
colord("#ffffff").toCmyk(); // { c: 0, m: 0, y: 0, k: 0, a: 1 }
colord("#999966").toCmykString(); // "device-cmyk(0% 0% 33% 40%)"
colord({ c: 0, m: 0, y: 0, k: 100, a: 1 }).toHex(); // "#000000"
colord("device-cmyk(0% 61% 72% 0% / 50%)").toHex(); // "#ff634780"
```
</details>
<details>
<summary><b><code>hwb</code> (HWB color model)</b> <i>0.8 KB</i></summary>

@@ -775,2 +830,12 @@

## Projects using Colord
- [cssnano](https://github.com/cssnano/cssnano) — the most popular CSS minification tool
- [Resume.io](https://resume.io/) — online resume builder with over 12,000,000 users worldwide
- [Leva](https://github.com/pmndrs/leva) — open source extensible GUI panel made for React
- [Qui Max](https://github.com/Qvant-lab/qui-max) — Vue.js design system and component library
- and [thousands more](https://github.com/omgovich/colord/network/dependents)...
<div><img src="assets/divider.png" width="838" alt="---" /></div>
## Roadmap

@@ -795,2 +860,2 @@

- [x] Mix colors (via plugin)
- [ ] CMYK color space (via plugin)
- [x] CMYK color space (via plugin)

@@ -36,2 +36,8 @@ export declare type RgbColor = {

}
export interface CmykColor {
c: number;
m: number;
y: number;
k: number;
}
declare type WithAlpha<O> = O & {

@@ -49,6 +55,7 @@ a: number;

export declare type LchaColor = WithAlpha<LchColor>;
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor;
export declare type CmykaColor = WithAlpha<CmykColor>;
export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor;
export declare type AnyColor = string | ObjectColor;
export declare type InputObject = Record<string, unknown>;
export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch";
export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch" | "cmyk";
export declare type Input = string | InputObject;

@@ -55,0 +62,0 @@ export declare type ParseResult = [RgbaColor, Format];

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc