New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

colorformat

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorformat - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

16

index.js

@@ -10,9 +10,15 @@ (function (root, factory) {

}(this, function () {
function hexToDec(n) {
function decToHex(n) {
return n.toString(16);
}
function decToHex(n) {
function hexToDec(n) {
return parseInt(n, 16);
}
function fixDigits(s){
if(s.length != 2) return '0' + s;
else return s;
}
return {

@@ -31,3 +37,3 @@ rgbToHex: function(r, g, b) {

throw new Error('Expected arguments to be between 0 and 255');
return '#' + hexToDec(r) + hexToDec(g) + hexToDec(b);
return '#' + fixDigits(decToHex(r)) + fixDigits(decToHex(g)) + fixDigits(decToHex(b));
},

@@ -45,7 +51,7 @@

if(options && options.styling)
return 'rgb(' + decToHex(h[0]+h[1]) + ', ' + decToHex(h[2]+h[3]) + ', ' + decToHex(h[4]+h[5]) + ')';
return 'rgb(' + hexToDec(h[0]+h[1]) + ', ' + hexToDec(h[2]+h[3]) + ', ' + hexToDec(h[4]+h[5]) + ')';
else
return [decToHex(h[0]+h[1]), decToHex(h[2]+h[3]), decToHex(h[4]+h[5])];
return [hexToDec(h[0]+h[1]), hexToDec(h[2]+h[3]), hexToDec(h[4]+h[5])];
}
};
}));
{
"name": "colorformat",
"version": "1.2.1",
"version": "1.2.2",
"description": "Convert color format from RGB to HEX and vice versa",

@@ -5,0 +5,0 @@ "main": "index.js",

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