Socket
Socket
Sign inDemoInstall

tinycolor2

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinycolor2 - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

component.json
{
"name": "tinycolor",
"repository": "bgrins/TinyColor",
"version": "1.0.0",
"version": "1.1.0",
"main": "tinycolor.js",

@@ -6,0 +6,0 @@ "scripts": ["tinycolor.js"],

{
"version": "1.0.0",
"version": "1.1.0",
"name": "tinycolor2",

@@ -4,0 +4,0 @@ "description": "Fast Color Parsing and Manipulation",

test("TinyColor initialization", function() {
ok (typeof tinycolor != "undefined", "tinycolor is initialized on the page");
ok (typeof tinycolor("red") == "object", "tinycolor is able to be instantiated.");
ok (typeof tinycolor("red") == "object", "tinycolor is able to be instantiated");
var r = tinycolor("red");
ok (tinycolor(r) === r, "when given a tinycolor instance, tinycolor() returns it.");
ok (new tinycolor(r) === r, "when given a tinycolor instance, new tinycolor() returns it.");
ok (tinycolor(r) === r, "when given a tinycolor instance, tinycolor() returns it");
ok (new tinycolor(r) === r, "when given a tinycolor instance, new tinycolor() returns it");
equal (tinycolor("red", { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed");

@@ -12,2 +12,19 @@ equal (tinycolor.fromRatio({r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed");

test("Original input", function() {
var colorRgbUp = "RGB(39, 39, 39)",
colorRgbLow = "rgb(39, 39, 39)",
colorRgbMix = "RgB(39, 39, 39)",
tinycolorObj = tinycolor(colorRgbMix),
inputObj = {r:100,g:100,b:100};
var r = tinycolor("red");
ok (tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, "original lowercase input is returned");
ok (tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, "original uppercase input is returned");
ok (tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, "original mixed input is returned");
ok (tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, "when given a tinycolor instance, the color string is returned");
ok (tinycolor(inputObj).getOriginalInput() === inputObj, "when given an object, the object is returned");
ok (new tinycolor("").getOriginalInput() === "", "when given an empty string, an empty string is returned");
ok (new tinycolor(null).getOriginalInput() === "", "when given a null value, an empty string is returned");
});
// Taken from convertWikipediaColors.html

@@ -14,0 +31,0 @@ var conversions = [

@@ -1,2 +0,2 @@

// TinyColor v1.0.0
// TinyColor v1.1.0
// https://github.com/bgrins/TinyColor

@@ -31,2 +31,3 @@ // Brian Grinstead, MIT License

var rgb = inputToRGB(color);
this._originalInput = color,
this._r = rgb.r,

@@ -62,2 +63,5 @@ this._g = rgb.g,

},
getOriginalInput: function() {
return this._originalInput;
},
getFormat: function() {

@@ -64,0 +68,0 @@ return this._format;

Sorry, the diff of this file is not supported yet

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