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

color

Package Overview
Dependencies
Maintainers
1
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.7.1 to 0.7.2

bower.json

17

color.js

@@ -5,7 +5,6 @@ /* MIT license */

module.exports = function(cssString) {
return new Color(cssString);
};
var Color = function(cssString) {
if (cssString instanceof Color) return cssString;
if (! (this instanceof Color)) return new Color(cssString);
var Color = function(cssString) {
this.values = {

@@ -33,3 +32,3 @@ rgb: [0, 0, 0],

else {
throw new Error("Unable to parse color from string " + cssString);
throw new Error("Unable to parse color from string \"" + cssString + "\"");
}

@@ -179,2 +178,6 @@ }

rgbNumber: function() {
return (this.values.rgb[0] << 16) | (this.values.rgb[1] << 8) | this.values.rgb[2];
},
luminosity: function() {

@@ -423,2 +426,3 @@ // http://www.w3.org/TR/WCAG20/#relativeluminancedef

Color.prototype.setChannel = function(space, index, val) {
console.log("setting channel", space, index, val);
if (val === undefined) {

@@ -429,2 +433,3 @@ // color.red()

// color.red(100)
console.log(this.values[space]);
this.values[space][index] = val;

@@ -434,1 +439,3 @@ this.setValues(space, this.values[space]);

}
module.exports = Color;

@@ -6,5 +6,4 @@ {

"author": "Heather Arthur <fayearthur@gmail.com>",
"repository": "harthur/color",
"repo": "harthur/color",
"main": "color.js",
"scripts": ["color.js"],
"dependencies": {

@@ -14,2 +13,3 @@ "harthur/color-convert": "*",

},
"scripts": ["color.js"],
"keywords": [

@@ -16,0 +16,0 @@ "color",

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

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

var Color = require("./color");
console.log(Color([255,255,255]).alpha(0).hslaString()); // "hsla(0, 0%, 0%, 1)"
var color = Color({ h : 0, s : 0, v : 100 });
console.log(color.hslString());
// color.hexString(); // #FFFFFF
// color.hue(100);
// color.hexString(); // #NANNANNAN
//var color = Color("#7743CE").rgb();
console.log(color.hexString());
var Color = require("../color"),
assert = require("assert");
// Color() instance
assert.equal(new Color("red").red(), 255);
assert.ok((new Color) instanceof Color);
// Color() argument

@@ -112,2 +117,5 @@ assert.deepEqual(Color("#0A1E19").rgb(), {r: 10, g: 30, b: 25});

// Number getters
assert.equal(Color("rgb(10, 30, 25)").rgbNumber(), 0xA1E19)
// luminosity, etc.

@@ -114,0 +122,0 @@ assert.equal(Color("white").luminosity(), 1);

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