Socket
Socket
Sign inDemoInstall

colord

Package Overview
Dependencies
0
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.8.0 to 2.9.0

plugins/minify.d.ts

4

CHANGELOG.md

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

### 2.9.0
- New plugin: Color string minification 🗜
### 2.8.0

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

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

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

"mix",
"minify",
"harmonies"

@@ -68,2 +69,7 @@ ],

},
"./plugins/minify": {
"import": "./plugins/minify.mjs",
"require": "./plugins/minify.js",
"default": "./plugins/minify.mjs"
},
"./plugins/mix": {

@@ -178,2 +184,6 @@ "import": "./plugins/mix.mjs",

{
"path": "dist/plugins/minify.mjs",
"limit": "0.5 KB"
},
{
"path": "dist/plugins/mix.mjs",

@@ -180,0 +190,0 @@ "limit": "1 KB"

@@ -746,2 +746,31 @@ <div align="center">

<details>
<summary><b><code>.minify(options?)</code></b></summary>
Converts a color to its shortest string representation.
```js
import { colord, extend } from "colord";
import minifyPlugin from "colord/plugins/minify";
extend([minifyPlugin]);
colord("black").minify(); // "#000"
colord("#112233").minify(); // "#123"
colord("darkgray").minify(); // "#a9a9a9"
colord("rgba(170,170,170,0.4)").minify(); // "hsla(0,0%,67%,.4)"
colord("rgba(170,170,170,0.4)").minify({ alphaHex: true }); // "#aaa6"
```
| Option | Default | Description |
| ------------- | ------- | ------------------------------------------------------------ |
| `hex` | `true` | Enable `#rrggbb` and `#rgb` notations |
| `alphaHex` | `false` | Enable `#rrggbbaa` and `#rgba` notations |
| `rgb` | `true` | Enable `rgb()` and `rgba()` functional notations |
| `hsl` | `true` | Enable `hsl()` and `hsla()` functional notations |
| `name` | `false` | Enable CSS color keywords. Requires `names` plugin installed |
| `transparent` | `false` | Enable `"transparent"` color keyword |
</details>
<div><img src="assets/divider.png" width="838" alt="---" /></div>

@@ -887,5 +916,25 @@

<details>
<summary><b><code>minify</code> (Color string minification)</b> <i>0.5 KB</i></summary>
A plugin adding color string minification utilities.
```js
import { colord, extend } from "colord";
import minifyPlugin from "colord/plugins/minify";
extend([minifyPlugin]);
colord("black").minify(); // "#000"
colord("#112233").minify(); // "#123"
colord("darkgray").minify(); // "#a9a9a9"
colord("rgba(170,170,170,0.4)").minify(); // "hsla(0,0%,67%,.4)"
colord("rgba(170,170,170,0.4)").minify({ alphaHex: true }); // "#aaa6"
```
</details>
<details>
<summary><b><code>mix</code> (Color mixing)</b> <i>0.96 KB</i></summary>
A plugin adding a color mixing utilities.
A plugin adding color mixing utilities.

@@ -892,0 +941,0 @@ In contrast to other libraries that perform RGB values mixing, Colord mixes colors through [LAB color space](https://en.wikipedia.org/wiki/CIELAB_color_space). This approach produces better results and doesn't have the drawbacks the legacy way has.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc