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.1.1 to 1.2.1

5

index.js

@@ -38,3 +38,6 @@ (function (root, factory) {

if(h.length != 6) throw new TypeError('Expected a 6 digit hex');
if(h.length === 3) h = h.replace(/(\w)/g, '$&$&');
if(h.length != 6) throw new TypeError('Expected a 3 or 6 digit hex');
if(options && options.styling)

@@ -41,0 +44,0 @@ return 'rgb(' + decToHex(h[0]+h[1]) + ', ' + decToHex(h[2]+h[3]) + ', ' + decToHex(h[4]+h[5]) + ')';

{
"name": "colorformat",
"version": "1.1.1",
"version": "1.2.1",
"description": "Convert color format from RGB to HEX and vice versa",

@@ -13,3 +13,4 @@ "main": "index.js",

"rgb",
"hex"
"hex",
"convert"
],

@@ -16,0 +17,0 @@ "author": "Maria Kousta",

21

README.md
# colorformat
A JavaScript lib to convert color format from RGB to HEX and vice versa
A simple JavaScript library to convert color format from RGB to HEX and vice versa
## Installation

@@ -14,3 +15,3 @@

```
```javascript
cf = require('colorformat');

@@ -20,4 +21,3 @@

or
// or with string input
cf.rgbToHex('230', '241', '246'); // => '#e6f1f6'

@@ -28,3 +28,3 @@ ```

```
```javascript
cf = require('colorformat');

@@ -34,4 +34,3 @@

or // if you want a styling string format
// or if you want a string for styling
cf.hexToRgb('#e6f1f6', { styling: true }); //=> 'rgb(230, 241, 246)'

@@ -41,2 +40,8 @@

Note: [UMD](https://github.com/umdjs/umd) is also supported for browser use.
## The simplest browser use
Load the script `node_modules/colorformat/index.js` and then simply:
```javascript
ColorFormat.rgbToHex(230, 241, 246); // => '#e6f1f6'
```
**Note:** Supports [UMD](https://github.com/umdjs/umd) for easier browser use with the tools of your preference.
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