Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

colormangle

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colormangle - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

colormangle.js

28

package.json
{
"name": "colormangle",
"version": "0.1.2",
"description": "converts html color strings to various format",
"main": "colormangle.min.js",
"version": "0.1.3",
"description": "",
"main": "colormangle.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"prod": "webpack -- --env mode=production"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/broadwayinc/colormangle.git"
},
"keywords": [
"colormangle"
],
"keywords": [],
"author": "Baksa Gimm",
"license": "MIT",
"bugs": {
"url": "https://github.com/broadwayinc/colormangle/issues"
"devDependencies": {
"@babel/core": "^7.13.8",
"@babel/preset-env": "^7.13.9",
"babel-loader": "^8.2.2",
"webpack": "^5.24.2",
"webpack-cli": "^4.5.0"
},
"homepage": "https://github.com/broadwayinc/colormangle#readme"
"dependencies": {
"babel-polyfill": "^6.26.0"
}
}

@@ -1,6 +0,8 @@

<img alt="APM" src="https://img.shields.io/apm/l/vim-mode"> [![Github All Releases](https://img.shields.io/github/downloads/broadwayinc/colormangle/total.svg)]()
<img alt="APM" src="https://img.shields.io/apm/l/vim-mode">
# ColorMangle
**ColorMangle** converts color strings to various format,
calculates appropriate text color based on contrast ratio.
# ColorMangle <br />
[Getting started](#getting-started) | [ColorMangle()](#new-ColorMangle) | [.hex()](#hex) | [.rgba()](#rgba) | [.hsla()](#hsla) | [.contrastRatio()](#contrastRatio) | [.textColor()](#textColor) | [License](#license) </br>
**ColorMangle** converts color strings to various format and calculates appropriate text color based on contrast ratio.
<br />

@@ -19,6 +21,16 @@ ## Getting started

<br />
On node.js or webpack based projects
```
npm i colormangle
```
And in your javascript:
```
import {ColorMangle} from 'colormangle';
```
<br />
## Basic usage
### new ColorMangle()
### ColorMangle()

@@ -41,3 +53,3 @@ **ColorMangle** input argument string can be either colorname string or any type of HTML color codes (hex, rgb, hsl).

**_Example_**
**_Example 1_**

@@ -66,3 +78,3 @@ ```

**_Example_**
**_Example 2_**

@@ -95,3 +107,3 @@ ```

```
**_Example_**
**_Example 3_**

@@ -116,2 +128,12 @@ ```

### .contrastRatio()
**.contrastRatio()** calculates the contrast ratio between the given colors.
**_Example 4_**
```
new ColorMangle('red').contrastRatio('white')
// returns 3.9984767707539985
```
<br />
### .textColor()

@@ -121,7 +143,7 @@

**_Example 1_**
**_Example 5_**
```
new ColorMangle('blue').textColor()
// returns hex format text color '#ffffff'.
// returns hex format text color '#ffffff'
// white (#ffffff)' is the recommended output text color to be used on blue background.

@@ -135,3 +157,3 @@

**_Example 2_**
**_Example 6_**

@@ -138,0 +160,0 @@ ```

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