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

color

Package Overview
Dependencies
Maintainers
0
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

18

color.js

@@ -310,17 +310,9 @@ /* MIT license */

var hsl = color.hslArray();
var hsl2 = color2.hslArray();
if (hsl[1] == 0) {
// grey blended with any other color shouldn't average to another hue
hsl[0] = hsl2[0];
}
else if(hsl2[1] == 0) {
hsl2[0] = hsl[0];
}
var rgb = color.rgbArray();
var rgb2 = color2.rgbArray();
for (var i = 0; i < hsl.length; i++) {
hsl[i] = hsl[i] * weight1 + hsl2[i] * weight2;
for (var i = 0; i < rgb.length; i++) {
rgb[i] = rgb[i] * weight1 + rgb2[i] * weight2;
}
setValues("hsl", hsl);
setValues("rgb", rgb);

@@ -327,0 +319,0 @@ var alpha = color.alpha() * weight + color2.alpha() * (1 - weight);

{
"name": "color",
"description": "Color conversion and manipulation with CSS string support",
"version": "0.1.3",
"version": "0.2.0",
"author": "Heather Arthur <fayearthur@gmail.com>",

@@ -6,0 +6,0 @@ "repository": {

@@ -32,7 +32,4 @@ # color

var color = Color("rgb(255, 255, 255)")
var color = Color({r: 255, g: 255, b: 255})
var color = Color().rgb(255, 255, 255)
var color = Color().rgb([255, 255, 255])

@@ -91,3 +88,3 @@ ```

color.mix(Color("yellow")) // cyan -> lime
color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128)

@@ -94,0 +91,0 @@ // chaining

@@ -102,6 +102,7 @@ var Color = require("../color"),

assert.equal(Color({h: 60, s: 0, l: 0}).rotate(-180).hue(), 240);
assert.equal(Color("yellow").mix(Color("cyan")).keyword(), "lime");
assert.deepEqual(Color("yellow").mix(Color("grey")).hslArray(), [60, 50, 50]);
assert.deepEqual(Color("yellow").mix(Color("grey"), 1).hslArray(), [60, 0, 50]);
assert.deepEqual(Color("yellow").mix(Color("grey"), 0.8).hslArray(), [60, 20, 50]);
assert.deepEqual(Color("yellow").mix(Color("cyan").alpha(0.5)).hslaArray(), [90, 100, 50, 0.75]);
assert.deepEqual(Color("yellow").mix(Color("cyan")).rgbArray(), [128, 255, 128]);
assert.deepEqual(Color("yellow").mix(Color("grey")).rgbArray(), [192, 192, 64]);
assert.deepEqual(Color("yellow").mix(Color("grey"), 1).rgbArray(), [128, 128, 128]);
assert.deepEqual(Color("yellow").mix(Color("grey"), 0.8).rgbArray(), [153, 153, 102]);
assert.deepEqual(Color("yellow").mix(Color("grey").alpha(0.5)).rgbaArray(), [223, 223, 32, 0.75]);
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