colorfactory
Advanced tools
Comparing version 0.1.4 to 0.2.0
{ | ||
"name": "colorfactory", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "Awesome methods for working with colors in javascript.", | ||
@@ -15,2 +15,3 @@ "keywords": [ | ||
"bugs": "https://github.com/Krinkle/node-colorfactory/issues", | ||
"license": "MIT", | ||
"author": { | ||
@@ -25,3 +26,3 @@ "name": "Andrew Peterson" | ||
], | ||
"main": "./node-colorfactory.js", | ||
"main": "./index.js", | ||
"repository": { | ||
@@ -31,16 +32,16 @@ "type": "git", | ||
}, | ||
"scripts": { | ||
"test": "eslint . && karma start" | ||
}, | ||
"devDependencies": { | ||
"grunt": "0.4.5", | ||
"grunt-contrib-jshint": "0.10.0", | ||
"grunt-jscs": "1.0.0", | ||
"grunt-karma": "0.9.0", | ||
"karma": "0.12.28", | ||
"karma-firefox-launcher": "0.1.3", | ||
"karma-phantomjs-launcher": "0.1.4", | ||
"karma-qunit": "0.1.4", | ||
"qunitjs": "1.16.0" | ||
"eslint": "4.3.0", | ||
"karma": "1.7.0", | ||
"karma-chrome-launcher": "2.2.0", | ||
"karma-cli": "^1.0.1", | ||
"karma-qunit": "1.2.1", | ||
"qunitjs": "2.4.0" | ||
}, | ||
"scripts": { | ||
"test": "grunt test" | ||
} | ||
"eslintIgnore": [ | ||
"/lib" | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/Krinkle/node-colorfactory.svg?branch=master)](https://travis-ci.org/Krinkle/node-colorfactory) [![npm](https://img.shields.io/npm/v/node-colorfactory.svg?style=flat)](https://www.npmjs.com/package/node-colorfactory) | ||
[![Build Status](https://travis-ci.org/Krinkle/node-colorfactory.svg?branch=master)](https://travis-ci.org/Krinkle/node-colorfactory) [![npm](https://img.shields.io/npm/v/colorfactory.svg?style=flat)](https://www.npmjs.com/package/colorfactory) | ||
@@ -11,3 +11,3 @@ ColorFactory | ||
```bash | ||
npm install node-colorfactory | ||
npm install colorfactory | ||
``` | ||
@@ -14,0 +14,0 @@ |
@@ -5,3 +5,2 @@ /*! | ||
* Copyright (c) 2010-2012 Andrew J. Peterson / NDP Software. | ||
* All Rights Reserved. | ||
*/ | ||
@@ -154,5 +153,7 @@ (function () { | ||
// Expose: Server or browser | ||
/* eslint-disable no-undef */ | ||
if (typeof module !== 'undefined' && module.exports) { | ||
ColorHelper = require('./ColorHelper'); | ||
module.exports = ColorFactory; | ||
/* eslint-enable */ | ||
} else { | ||
@@ -159,0 +160,0 @@ ColorHelper = this.ColorHelper; |
@@ -449,4 +449,6 @@ /*! | ||
// Expose: Server or browser | ||
/* eslint-disable no-undef */ | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = ColorHelper; | ||
/* eslint-enable no-undef */ | ||
} else { | ||
@@ -453,0 +455,0 @@ this.ColorHelper = ColorHelper; |
QUnit.module('ColorHelper', { | ||
setup: function () { | ||
beforeEach: function () { | ||
// Off by default, used in the test suite for convinience | ||
ColorHelper.clobberPrototype(); | ||
}, | ||
teardown: function () { | ||
afterEach: function () { | ||
ColorHelper.restorePrototype(); | ||
@@ -8,0 +8,0 @@ } |
@@ -5,3 +5,3 @@ /* Utilities */ | ||
target = target || 'body'; | ||
$(document).ready(function () { | ||
$(function () { | ||
var i, | ||
@@ -26,3 +26,3 @@ $swatches = $('<div>').addClass('test-colorFactory-swatches'); | ||
QUnit.colorTest = function (title, actualColors, callback) { | ||
QUnit.test(title, function () { | ||
return QUnit.test(title, function () { | ||
this.renderColors = function (colors, label) { | ||
@@ -35,3 +35,3 @@ renderColors(colors, '#qunit-test-output-' + QUnit.config.current.testId, label); | ||
callback.apply(this, arguments); | ||
return callback.apply(this, arguments); | ||
}); | ||
@@ -41,3 +41,3 @@ }; | ||
QUnit.colorTest.closeMatch = function (title, actualColors, expectedColors, threshold) { | ||
QUnit.colorTest(title, actualColors, function (assert) { | ||
return QUnit.colorTest(title, actualColors, function (assert) { | ||
this.renderColors(expectedColors, 'match'); | ||
@@ -53,3 +53,3 @@ | ||
QUnit.colorTest.complementary = function (input, expected) { | ||
QUnit.colorTest.closeMatch('complementaryColors() for ' + input, | ||
return QUnit.colorTest.closeMatch('complementaryColors() for ' + input, | ||
ColorFactory.complementary(input), | ||
@@ -64,3 +64,3 @@ [expected, input] | ||
QUnit.colorTest.binary = function (message, input, expected, threshold) { | ||
QUnit.colorTest.closeMatch(message, | ||
return QUnit.colorTest.closeMatch(message, | ||
ColorFactory.binary(input), | ||
@@ -73,3 +73,3 @@ [input, expected], | ||
QUnit.colorTest.distinguishable = function (title, colors, callback) { | ||
QUnit.colorTest(title, colors, function (assert) { | ||
return QUnit.colorTest(title, colors, function (assert) { | ||
assert.colorIsDistinguishable(colors); | ||
@@ -85,8 +85,8 @@ if (callback) { | ||
QUnit.assert.match = function (actual, regex, message) { | ||
QUnit.push( | ||
regex.test(actual), | ||
actual, | ||
regex, | ||
message | ||
); | ||
this.pushResult( { | ||
result: regex.test(actual), | ||
actual: actual, | ||
expected: regex, | ||
message: message | ||
} ); | ||
}; | ||
@@ -98,3 +98,3 @@ | ||
if (colors.length < 2) { | ||
QUnit.pushFailure('assert.beDistinguishable expects two or more colors.'); | ||
this.pushFailure('assert.beDistinguishable expects two or more colors.'); | ||
return; | ||
@@ -110,11 +110,11 @@ } | ||
diff = Math.abs(hsl0[0] - hsl1[0]) + Math.abs(hsl0[1] - hsl1[1]) + Math.abs(hsl0[2] - hsl1[2]); | ||
QUnit.push( | ||
diff > 30, | ||
diff, | ||
'> 30', | ||
'color #' + i + ' ' + c0 + | ||
this.pushResult( { | ||
result: diff > 30, | ||
actual: diff, | ||
expected: '> 30', | ||
message: 'color #' + i + ' ' + c0 + | ||
' (' + hsl0.join(',') + ') is distinguishable from ' + | ||
'color #' + (i + 1) + ' ' + c1 + ' (' + hsl1.join(',') + ') ' + | ||
'in saturation and lightness' | ||
); | ||
} ); | ||
} | ||
@@ -142,8 +142,8 @@ }; | ||
QUnit.push( | ||
diffTotal < (threshold * 3), | ||
diffTotal + ' (differed HSV: [' + diff.join(',') + '])', | ||
diffTotal + ' < (threshold * 3)', | ||
'color ' + actual + ' is visually close to ' + expected + ' (within a threshold of: ' + threshold + ')' | ||
); | ||
this.pushResult( { | ||
result: diffTotal < (threshold * 3), | ||
actual: diffTotal + ' (differed HSV: [' + diff.join(',') + '])', | ||
expected: diffTotal + ' < (threshold * 3)', | ||
message: 'color ' + actual + ' is visually close to ' + expected + ' (within a threshold of: ' + threshold + ')' | ||
} ); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
316466
6
0
15
9546