You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

tinygradient

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinygradient - npm Package Compare versions

Comparing version

to
0.3.1

59

bower.json
{
"name": "tinygradient",
"version": "0.3.0",
"authors": [{
"name": "Damien \"Mistic\" Sorel",
"homepage": "http://www.strangeplanet.fr"
}],
"description": "Fast and small gradients manipulation, built on top of TinyColor",
"license": "MIT",
"homepage": "https://github.com/mistic100/tinygradient",
"main": "tinygradient.js",
"dependencies": {
"tinycolor": "~1.0.0"
},
"keywords": [
"color",
"gradient"
],
"repository": {
"type": "git",
"url": "git://github.com/mistic100/tinygradient.git"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
"name": "tinygradient",
"version": "0.3.1",
"authors": [
{
"name": "Damien \"Mistic\" Sorel",
"email": "contact@git.strangeplanet.fr",
"url": "http://www.strangeplanet.fr"
}
],
"description": "Fast and small gradients manipulation, built on top of TinyColor",
"license": "MIT",
"homepage": "https://github.com/mistic100/tinygradient",
"main": "tinygradient.js",
"dependencies": {
"tinycolor": "^1.0.0"
},
"keywords": [
"color",
"gradient"
],
"repository": {
"type": "git",
"url": "git://github.com/mistic100/tinygradient.git"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

@@ -7,4 +7,4 @@ module.exports = function(grunt) {

'/*!\n'+
' * jQuery TinyGradient <%= pkg.version %>\n'+
' * Copyright <%= grunt.template.today("yyyy") %> Damien "Mistic" Sorel (http://www.strangeplanet.fr)\n'+
' * TinyGradient <%= pkg.version %>\n'+
' * Copyright 2014-<%= grunt.template.today("yyyy") %> Damien "Mistic" Sorel (http://www.strangeplanet.fr)\n'+
' * Licensed under MIT (http://opensource.org/licenses/MIT)\n'+

@@ -19,7 +19,4 @@ ' */',

dist: {
files: {
'tinygradient.min.js': [
'tinygradient.js'
]
}
src: 'tinygradient.js',
dest: 'tinygradient.min.js'
}

@@ -31,7 +28,3 @@ },

lib: {
files: {
src: [
'tinygradient.js'
]
}
src: 'tinygradient.js'
}

@@ -43,5 +36,3 @@ },

unit: {
src: [
'tests/*.js'
]
src: 'tests/*.js'
}

@@ -48,0 +39,0 @@ }

{
"name": "tinygradient",
"version": "0.3.0",
"authors": [{
"name": "Damien \"Mistic\" Sorel",
"homepage": "http://www.strangeplanet.fr"
}],
"description": "Fast and small gradients manipulation, built on top of TinyColor",
"license": "MIT",
"homepage": "https://github.com/mistic100/tinygradient",
"main": "tinygradient.js",
"dependencies": {
"tinycolor2": "~1.0.0"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-mocha-test": "~0.12.0"
},
"keywords": [
"color",
"gradient"
],
"repository": {
"type": "git",
"url": "git://github.com/mistic100/tinygradient.git"
},
"bugs": {
"url": "https://github.com/mistic100/tinygradient/issues"
},
"scripts": {
"test": "grunt test --force"
}
}
"name": "tinygradient",
"version": "0.3.1",
"author": {
"name": "Damien \"Mistic\" Sorel",
"email": "contact@git.strangeplanet.fr",
"url": "http://www.strangeplanet.fr"
},
"description": "Fast and small gradients manipulation, built on top of TinyColor",
"license": "MIT",
"homepage": "https://github.com/mistic100/tinygradient",
"main": "tinygradient.js",
"dependencies": {
"tinycolor2": "^1.0.0"
},
"devDependencies": {
"grunt": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-mocha-test": "^0.13.0",
"mocha": "^3.1.0"
},
"keywords": [
"color",
"gradient"
],
"repository": {
"type": "git",
"url": "git://github.com/mistic100/tinygradient.git"
},
"bugs": {
"url": "https://github.com/mistic100/tinygradient/issues"
},
"scripts": {
"test": "grunt test"
}
}
TinyGradient
============
[![Bower version](https://badge.fury.io/bo/tinygradient.svg)](http://badge.fury.io/bo/tinygradient)
[![NPM version](https://badge.fury.io/js/tinygradient.svg)](http://badge.fury.io/js/tinygradient)
[![Bower version](https://img.shields.io/bower/v/tinygradient.svg?style=flat-square)](https://github.com/mistic100/tinygradient)
[![NPM version](https://img.shields.io/npm/v/tinygradient.svg?style=flat-square)](https://www.npmjs.com/package/tinygradient)

@@ -41,3 +41,3 @@ ## JavaScript gradients generator

{r: 0, g: 255, b: 0}, // RGB object
{h: 240: s: 1, v: 1, a: 1}, // HSVa object
{h: 240, s: 1, v: 1, a: 1}, // HSVa object
'rgb(120, 120, 0)', // RGB CSS string

@@ -44,0 +44,0 @@ 'gold' // named color

/*!
* TinyGradient
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
* TinyGradient 0.3.1
* Copyright 2014-2015 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/

@@ -7,0 +7,0 @@ (function(root, factory) {

/*!
* jQuery TinyGradient 0.3.0
* Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* TinyGradient 0.3.1
* Copyright 2014-2015 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
!function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("tinycolor2")):"function"==typeof define&&define.amd?define(["tinycolor"],b):a.tinygradient=b(a.tinycolor)}(this,function(a){"use strict";var b={rgba_max:{r:256,g:256,b:256,a:1},hsva_max:{h:360,s:1,v:1,a:1},stepize:function(a,b,c){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]=(b[e]-a[e])/c);return d},interpolate:function(a,b,c,d){var e={};for(var f in b)b.hasOwnProperty(f)&&(e[f]=a[f]*c+b[f],e[f]=e[f]<0?e[f]+d[f]:1!=d[f]?e[f]%d[f]:e[f]);return e},rgb:function(c,d,e){for(var f,g=c.color.toRgb(),h=d.color.toRgb(),i=[c.color],j=b.stepize(g,h,e),k=1;e>k;k++)f=b.interpolate(j,g,k,b.rgba_max),i.push(a(f));return i},hsv:function(c,d,e,f){var g,h,i=c.color.toHsv(),j=d.color.toHsv(),k=[c.color],l=b.stepize(i,j,e);g=i.h<=j.h&&!f||i.h>=j.h&&f?j.h-i.h:f?360-j.h+i.h:360-i.h+j.h,l.h=Math.pow(-1,f)*Math.abs(g)*1/e;for(var m=1;e>m;m++)h=b.interpolate(l,i,m,b.hsva_max),k.push(a(h));return k},substeps:function(a,b){var c=a.length;if(b=parseInt(b),isNaN(b)||2>b)throw new Error("Invalid number of steps (< 2)");if(c>b)throw new Error("Number of steps cannot be inferior to number of stops");for(var d=[],e=1;c>e;e++){var f=(b-1)*(a[e].pos-a[e-1].pos);d.push(Math.max(1,Math.round(f)))}for(var g=1,h=c-1;h--;)g+=d[h];for(;g!=b;)if(b>g){var i=Math.min.apply(null,d);d[d.indexOf(i)]++,g++}else{var j=Math.max.apply(null,d);d[d.indexOf(j)]--,g--}return d}},c=function(b){if(1==arguments.length){if(!(arguments[0]instanceof Array))throw new Error('"stops" is not an array');b=arguments[0]}else b=Array.prototype.slice.call(arguments);if(!(this instanceof c))return new c(b);if(b.length<2)throw new Error("Invalid number of stops (< 2)");var d=void 0!==b[0].pos,e=b.length,f=-1;this.stops=b.map(function(b,c){var g=void 0!==b.pos;if(d^g)throw new Error("Cannot mix positionned and not posionned color stops");if(g){if(b={color:a(b.color),pos:b.pos},b.pos<0||b.pos>1)throw new Error("Color stops positions must be between 0 and 1");if(b.pos<=f)throw new Error("Color stops positions are not ordered");f=b.pos}else b={color:a(b),pos:c/(e-1)};return b}),0!==this.stops[0].pos&&this.stops.unshift({color:this.stops[0].color,pos:0}),1!==this.stops[this.stops.length-1].pos&&this.stops.push({color:this.stops[this.stops.length-1].color,pos:1})};return c.prototype.reverse=function(){var a=[];return this.stops.forEach(function(b){a.push({color:b.color,pos:1-b.pos})}),new c(a.reverse())},c.prototype.rgb=function(a){for(var c=b.substeps(this.stops,a),d=[],e=0,f=this.stops.length;f-1>e;e++)d=d.concat(b.rgb(this.stops[e],this.stops[e+1],c[e]));return d.push(this.stops[f-1].color),d},c.prototype.hsv=function(a,c){for(var d,e,f,g=b.substeps(this.stops,a),h=c===!0,i="string"==typeof c,j=[],k=0,l=this.stops.length;l-1>k;k++)d=this.stops[k].color.toHsv(),e=this.stops[k+1].color.toHsv(),i&&(f=d.h<e.h&&e.h-d.h<180||d.h>e.h&&d.h-e.h>180),j=j.concat(0===d.s||0===e.s?b.rgb(this.stops[k],this.stops[k+1],g[k]):b.hsv(this.stops[k],this.stops[k+1],g[k],"long"===c&&f||"short"===c&&!f||!i&&h));return j.push(this.stops[l-1].color),j},c.prototype.css=function(a,b){a=a||"linear",b=b||("linear"==a?"to right":"ellipse at center");var c=a+"-gradient("+b;return this.stops.forEach(function(a){c+=", "+a.color.toRgbString()+" "+100*a.pos+"%"}),c+=")"},c.rgb=function(a,b){return a=Array.prototype.slice.call(arguments),b=a.pop(),c.apply(null,a).rgb(b)},c.hsv=function(a,b,d){return a=Array.prototype.slice.call(arguments),d=a.pop(),b=a.pop(),c.apply(null,a).hsv(b,d)},c.css=function(a,b,d){return a=Array.prototype.slice.call(arguments),d=a.pop(),b=a.pop(),c.apply(null,a).css(b,d)},c});
!function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("tinycolor2")):"function"==typeof define&&define.amd?define(["tinycolor"],b):a.tinygradient=b(a.tinycolor)}(this,function(a){"use strict";var b={rgba_max:{r:256,g:256,b:256,a:1},hsva_max:{h:360,s:1,v:1,a:1},stepize:function(a,b,c){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]=(b[e]-a[e])/c);return d},interpolate:function(a,b,c,d){var e={};for(var f in b)b.hasOwnProperty(f)&&(e[f]=a[f]*c+b[f],e[f]=e[f]<0?e[f]+d[f]:1!=d[f]?e[f]%d[f]:e[f]);return e},rgb:function(c,d,e){for(var f,g=c.color.toRgb(),h=d.color.toRgb(),i=[c.color],j=b.stepize(g,h,e),k=1;e>k;k++)f=b.interpolate(j,g,k,b.rgba_max),i.push(a(f));return i},hsv:function(c,d,e,f){var g,h,i=c.color.toHsv(),j=d.color.toHsv(),k=[c.color],l=b.stepize(i,j,e);g=i.h<=j.h&&!f||i.h>=j.h&&f?j.h-i.h:f?360-j.h+i.h:360-i.h+j.h,l.h=Math.pow(-1,f)*Math.abs(g)*1/e;for(var m=1;e>m;m++)h=b.interpolate(l,i,m,b.hsva_max),k.push(a(h));return k},substeps:function(a,b){var c=a.length;if(b=parseInt(b),isNaN(b)||2>b)throw new Error("Invalid number of steps (< 2)");if(c>b)throw new Error("Number of steps cannot be inferior to number of stops");for(var d=[],e=1;c>e;e++){var f=(b-1)*(a[e].pos-a[e-1].pos);d.push(Math.max(1,Math.round(f)))}for(var g=1,h=c-1;h--;)g+=d[h];for(;g!=b;)if(b>g){var i=Math.min.apply(null,d);d[d.indexOf(i)]++,g++}else{var j=Math.max.apply(null,d);d[d.indexOf(j)]--,g--}return d}},c=function(b){if(1==arguments.length){if(!(arguments[0]instanceof Array))throw new Error('"stops" is not an array');b=arguments[0]}else b=Array.prototype.slice.call(arguments);if(!(this instanceof c))return new c(b);if(b.length<2)throw new Error("Invalid number of stops (< 2)");var d=void 0!==b[0].pos,e=b.length,f=-1;this.stops=b.map(function(b,c){var g=void 0!==b.pos;if(d^g)throw new Error("Cannot mix positionned and not posionned color stops");if(g){if(b={color:a(b.color),pos:b.pos},b.pos<0||b.pos>1)throw new Error("Color stops positions must be between 0 and 1");if(b.pos<=f)throw new Error("Color stops positions are not ordered");f=b.pos}else b={color:a(b),pos:c/(e-1)};return b}),0!==this.stops[0].pos&&this.stops.unshift({color:this.stops[0].color,pos:0}),1!==this.stops[this.stops.length-1].pos&&this.stops.push({color:this.stops[this.stops.length-1].color,pos:1})};return c.prototype.reverse=function(){var a=[];return this.stops.forEach(function(b){a.push({color:b.color,pos:1-b.pos})}),new c(a.reverse())},c.prototype.rgb=function(a){for(var c=b.substeps(this.stops,a),d=[],e=0,f=this.stops.length;f-1>e;e++)d=d.concat(b.rgb(this.stops[e],this.stops[e+1],c[e]));return d.push(this.stops[f-1].color),d},c.prototype.hsv=function(a,c){for(var d,e,f,g=b.substeps(this.stops,a),h=c===!0,i="string"==typeof c,j=[],k=0,l=this.stops.length;l-1>k;k++)d=this.stops[k].color.toHsv(),e=this.stops[k+1].color.toHsv(),i&&(f=d.h<e.h&&e.h-d.h<180||d.h>e.h&&d.h-e.h>180),j=0===d.s||0===e.s?j.concat(b.rgb(this.stops[k],this.stops[k+1],g[k])):j.concat(b.hsv(this.stops[k],this.stops[k+1],g[k],"long"===c&&f||"short"===c&&!f||!i&&h));return j.push(this.stops[l-1].color),j},c.prototype.css=function(a,b){a=a||"linear",b=b||("linear"==a?"to right":"ellipse at center");var c=a+"-gradient("+b;return this.stops.forEach(function(a){c+=", "+a.color.toRgbString()+" "+100*a.pos+"%"}),c+=")"},c.rgb=function(a,b){return a=Array.prototype.slice.call(arguments),b=a.pop(),c.apply(null,a).rgb(b)},c.hsv=function(a,b,d){return a=Array.prototype.slice.call(arguments),d=a.pop(),b=a.pop(),c.apply(null,a).hsv(b,d)},c.css=function(a,b,d){return a=Array.prototype.slice.call(arguments),d=a.pop(),b=a.pop(),c.apply(null,a).css(b,d)},c});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet