colorformat
Advanced tools
Comparing version 1.0.1 to 1.1.1
@@ -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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2460
41
38