Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

husl

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

husl - npm Package Compare versions

Comparing version 5.0.3 to 6.0.0

138

husl.js

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

// Generated by CoffeeScript 1.9.1
// Generated by CoffeeScript 1.9.3
(function() {
var L_to_Y, Y_to_L, conv, distanceFromPole, dotProduct, epsilon, fromLinear, getBounds, intersectLineLine, kappa, lengthOfRayUntilIntersect, m, m_inv, maxChromaForLH, maxSafeChromaForL, refU, refV, refX, refY, refZ, rgbPrepare, root, round, toLinear;
var L_to_Y, Y_to_L, conv, distanceFromPole, dotProduct, epsilon, fromLinear, getBounds, intersectLineLine, kappa, lengthOfRayUntilIntersect, m, m_inv, maxChromaForLH, maxSafeChromaForL, refU, refV, refX, refY, refZ, root, toLinear;
m = {
R: [3.240969941904521, -1.537383177570093, -0.498610760293],
G: [-0.96924363628087, 1.87596750150772, 0.041555057407175],
B: [0.055630079696993, -0.20397695888897, 1.056971514242878]
R: [3.2409699419045214, -1.5373831775700935, -0.49861076029300328],
G: [-0.96924363628087983, 1.8759675015077207, 0.041555057407175613],
B: [0.055630079696993609, -0.20397695888897657, 1.0569715142428786]
};
m_inv = {
X: [0.41239079926595, 0.35758433938387, 0.18048078840183],
Y: [0.21263900587151, 0.71516867876775, 0.072192315360733],
Z: [0.019330818715591, 0.11919477979462, 0.95053215224966]
X: [0.41239079926595948, 0.35758433938387796, 0.18048078840183429],
Y: [0.21263900587151036, 0.71516867876775593, 0.072192315360733715],
Z: [0.019330818715591851, 0.11919477979462599, 0.95053215224966058]
};
refX = 0.95045592705167;
refX = 0.95045592705167173;
refY = 1.0;
refZ = 1.089057750759878;
refZ = 1.0890577507598784;
refU = 0.19783000664283;
refU = 0.19783000664283681;
refV = 0.46831999493879;
refV = 0.468319994938791;
kappa = 903.2962962;
kappa = 903.2962962962963;
epsilon = 0.0088564516;
epsilon = 0.0088564516790356308;

@@ -106,8 +106,2 @@ getBounds = function(L) {

round = function(num, places) {
var n;
n = Math.pow(10, places);
return Math.round(num * n) / n;
};
fromLinear = function(c) {

@@ -131,33 +125,2 @@ if (c <= 0.0031308) {

rgbPrepare = function(tuple) {
var ch, j, k, len1, len2, n, results;
tuple = (function() {
var j, len1, results;
results = [];
for (j = 0, len1 = tuple.length; j < len1; j++) {
n = tuple[j];
results.push(round(n, 3));
}
return results;
})();
for (j = 0, len1 = tuple.length; j < len1; j++) {
ch = tuple[j];
if (ch < -0.0001 || ch > 1.0001) {
throw new Error("Illegal rgb value: " + ch);
}
if (ch < 0) {
ch = 0;
}
if (ch > 1) {
ch = 1;
}
}
results = [];
for (k = 0, len2 = tuple.length; k < len2; k++) {
ch = tuple[k];
results.push(Math.round(ch * 255));
}
return results;
};
conv = {

@@ -238,7 +201,11 @@ 'xyz': {},

L = tuple[0], U = tuple[1], V = tuple[2];
C = Math.pow(Math.pow(U, 2) + Math.pow(V, 2), 1 / 2);
Hrad = Math.atan2(V, U);
H = Hrad * 360 / 2 / Math.PI;
if (H < 0) {
H = 360 + H;
C = Math.sqrt(Math.pow(U, 2) + Math.pow(V, 2));
if (C < 0.00000001) {
H = 0;
} else {
Hrad = Math.atan2(V, U);
H = Hrad * 360 / 2 / Math.PI;
if (H < 0) {
H = 360 + H;
}
}

@@ -260,10 +227,8 @@ return [L, C, H];

H = tuple[0], S = tuple[1], L = tuple[2];
if (L > 99.9999999) {
return [100, 0, H];
if (L > 99.9999999 || L < 0.00000001) {
C = 0;
} else {
max = maxChromaForLH(L, H);
C = max / 100 * S;
}
if (L < 0.00000001) {
return [0, 0, H];
}
max = maxChromaForLH(L, H);
C = max / 100 * S;
return [L, C, H];

@@ -275,10 +240,8 @@ };

L = tuple[0], C = tuple[1], H = tuple[2];
if (L > 99.9999999) {
return [H, 0, 100];
if (L > 99.9999999 || L < 0.00000001) {
S = 0;
} else {
max = maxChromaForLH(L, H);
S = C / max * 100;
}
if (L < 0.00000001) {
return [H, 0, 0];
}
max = maxChromaForLH(L, H);
S = C / max * 100;
return [H, S, L];

@@ -290,10 +253,8 @@ };

H = tuple[0], S = tuple[1], L = tuple[2];
if (L > 99.9999999) {
return [100, 0, H];
if (L > 99.9999999 || L < 0.00000001) {
C = 0;
} else {
max = maxSafeChromaForL(L);
C = max / 100 * S;
}
if (L < 0.00000001) {
return [0, 0, H];
}
max = maxSafeChromaForL(L);
C = max / 100 * S;
return [L, C, H];

@@ -305,10 +266,8 @@ };

L = tuple[0], C = tuple[1], H = tuple[2];
if (L > 99.9999999) {
return [H, 0, 100];
if (L > 99.9999999 || L < 0.00000001) {
S = 0;
} else {
max = maxSafeChromaForL(L);
S = C / max * 100;
}
if (L < 0.00000001) {
return [H, 0, 0];
}
max = maxSafeChromaForL(L);
S = C / max * 100;
return [H, S, L];

@@ -320,6 +279,9 @@ };

hex = "#";
tuple = rgbPrepare(tuple);
for (j = 0, len1 = tuple.length; j < len1; j++) {
ch = tuple[j];
ch = ch.toString(16);
ch = Math.round(ch * 1e6) / 1e6;
if (ch < 0 || ch > 1) {
throw new Error("Illegal rgb value: " + ch);
}
ch = Math.round(ch * 255).toString(16);
if (ch.length === 1) {

@@ -412,6 +374,2 @@ ch = "0" + ch;

root._round = round;
root._rgbPrepare = rgbPrepare;
root._getBounds = getBounds;

@@ -418,0 +376,0 @@

{
"name": "husl",
"description": "Replacement for the HSL color space",
"description": "Human-friendly HSL",
"keywords": ["color", "color space", "CIE", "RGB", "HUSL", "HSL"],
"version": "5.0.3",
"version": "6.0.0",
"author": "Alexei Boronine <alexei@boronine.com>",
"license": "MIT",
"main": "husl.js",

@@ -8,0 +9,0 @@ "files": ["husl.js"],

[![Build Status](https://travis-ci.org/husl-colors/husl.svg?branch=master)](https://travis-ci.org/husl-colors/husl)
[![Package Version](https://img.shields.io/npm/v/husl.svg)](https://www.npmjs.com/package/husl)

@@ -53,8 +54,20 @@ [Explanation, demo, ports etc.](http://www.husl-colors.org)

Copyright (C) 2014 Alexei Boronine
Copyright (c) 2015 Alexei Boronine
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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