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.9.0 to 2.9.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

### 2.9.1
- Fix: Make minification lossless
- Fix: Minify to name only if color is opaque
### 2.9.0

@@ -2,0 +7,0 @@

4

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

@@ -183,3 +183,3 @@ "keywords": [

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

@@ -186,0 +186,0 @@ {

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

module.exports=function(t){var r=function(t){return t>0&&t<1?t.toString().replace("0.","."):t};t.prototype.minify=function(t){void 0===t&&(t={});var n=this.toRgb(),e=r(n.r),h=r(n.g),s=r(n.b),i=this.toHsl(),a=r(i.h),o=r(i.s),u=r(i.l),l=r(this.alpha()),p=Object.assign({hex:!0,rgb:!0,hsl:!0},t),f=[];if(p.hex&&(1===l||p.alphaHex)&&f.push(function(t){var r=t.toHex(),n=r.split(""),e=n[1],h=n[3],s=n[5],i=n[7],a=n[8];if(e===n[2]&&h===n[4]&&s===n[6]){if(1===t.alpha())return"#"+e+h+s;if(i===a)return"#"+e+h+s+i}return r}(this)),p.rgb&&f.push(1===l?"rgb("+e+","+h+","+s+")":"rgba("+e+","+h+","+s+","+l+")"),p.hsl&&f.push(1===l?"hsl("+a+","+o+"%,"+u+"%)":"hsla("+a+","+o+"%,"+u+"%,"+l+")"),p.transparent&&0===e&&0===h&&0===s&&0===l)f.push("transparent");else if(p.name&&"function"==typeof this.toName){var g=this.toName();g&&f.push(g)}return function(t){for(var r=t[0],n=1;n<t.length;n++)t[n].length<r.length&&(r=t[n]);return r}(f)}};
module.exports=function(t){var r=function(t){var r,n,e,i=t.toHex(),a=t.alpha(),h=i.split(""),s=h[1],o=h[2],u=h[3],l=h[4],p=h[5],f=h[6],g=h[7],v=h[8];if(a>0&&a<1&&(r=parseInt(g+v,16)/255,void 0===(n=2)&&(n=0),void 0===e&&(e=Math.pow(10,n)),Math.round(e*r)/e+0!==a))return null;if(s===o&&u===l&&p===f){if(1===a)return"#"+s+u+p;if(g===v)return"#"+s+u+p+g}return i},n=function(t){return t>0&&t<1?t.toString().replace("0.","."):t};t.prototype.minify=function(t){void 0===t&&(t={});var e=this.toRgb(),i=n(e.r),a=n(e.g),h=n(e.b),s=this.toHsl(),o=n(s.h),u=n(s.s),l=n(s.l),p=n(this.alpha()),f=Object.assign({hex:!0,rgb:!0,hsl:!0},t),g=[];if(f.hex&&(1===p||f.alphaHex)){var v=r(this);v&&g.push(v)}if(f.rgb&&g.push(1===p?"rgb("+i+","+a+","+h+")":"rgba("+i+","+a+","+h+","+p+")"),f.hsl&&g.push(1===p?"hsl("+o+","+u+"%,"+l+"%)":"hsla("+o+","+u+"%,"+l+"%,"+p+")"),f.transparent&&0===i&&0===a&&0===h&&0===p)g.push("transparent");else if(1===p&&f.name&&"function"==typeof this.toName){var c=this.toName();c&&g.push(c)}return function(t){for(var r=t[0],n=1;n<t.length;n++)t[n].length<r.length&&(r=t[n]);return r}(g)}};

Sorry, the diff of this file is not supported yet

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