Huge News!Announcing our $40M Series B led by Abstract Ventures.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.0.1 to 1.1.1

8

index.js

@@ -33,3 +33,3 @@ (function (root, factory) {

hexToRgb: function(h) {
hexToRgb: function(h, options) {
if(typeof h !== 'string') throw new TypeError('Expected a string input');

@@ -40,6 +40,8 @@

if(h.length != 6) throw new TypeError('Expected a 6 digit hex');
return [decToHex(h[0]+h[1]), decToHex(h[2]+h[3]), decToHex(h[4]+h[5])];
if(options && options.styling)
return 'rgb(' + decToHex(h[0]+h[1]) + ', ' + decToHex(h[2]+h[3]) + ', ' + decToHex(h[4]+h[5]) + ')';
else
return [decToHex(h[0]+h[1]), decToHex(h[2]+h[3]), decToHex(h[4]+h[5])];
}
};
}));
{
"name": "colorformat",
"version": "1.0.1",
"version": "1.1.1",
"description": "Convert color format from RGB to HEX and vice versa",

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

@@ -30,4 +30,9 @@ # colorformat

cf.hexToRgb('#e6f1f6'); //=> [ 230, 241, 246 ]
or // if you want a styling string format
cf.hexToRgb('#e6f1f6', { styling: true }); //=> 'rgb(230, 241, 246)'
```
Note: [UMD](https://github.com/umdjs/umd) is also supported for browser use.
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