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

javascript-color-gradient

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-color-gradient - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

2

package.json
{
"name": "javascript-color-gradient",
"version": "2.3.2",
"version": "2.3.3",
"description": "javascript-color-gradient is a lightweight JavaScript library, used to generate an array of color gradients by providing start and finish colors, as well as the required number of midpoints. ",

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

<div>
<img src="https://mymodernmet.com/wp/wp-content/uploads/2018/09/color-theory-basics.jpg" height="140">
<h1>JavasScript Color Gradient</h1>
<h1>JavaScript Color Gradient</h1>
<p>Lightweight JavaScript library, used to generate an array of color gradients by providing start and finish colors, as well as the required number of midpoints.</p>

@@ -41,23 +41,30 @@ </div>

Let's see them in action:
## Usage
Using 2 colors and default (10) midpoints to generate an array of hex color values:
```javascript
console.log(colorGradient.getArray());
// ["#4e4ab9", "#5d68c4", "#6d86ce", "#7ca4d9", "#8bc2e3"]
import Gradient from "javascript-color-gradient";
console.log(colorGradient.getColor(3));
// #6d86ce
const gradientArray = colorGradient.setGradient("#3F2CAF", "e9446a").getArray();
console.log(gradientArray);
// ["#502ea8", "#6131a1", "#72339a", "#833693", "#94388d", "#a53a86", "#b63d7f", "#c73f78", "#d84271", "#e9446a"]
```
## Usage
Using 4 colors and 20 midpoints to generate an array of hex color values :
Using two color gradients
```javascript
import Gradient from "javascript-color-gradient";
import colorGradient from "javascript-color-gradient";
colorGradient.setGradient("#3F2CAF", "#8BC2E3");
const gradientArray = colorGradient
.setGradient("#3F2CAF", "#e9446a", "#edc988", "#607D8B")
.setMidpoint(20)
.getArray();
console.log(gradientArray);
// ["#5930a5", "#72339a", "#8c3790", "#a53a86", "#bf3e7b", "#d84271", "#e94b6c", "#ea5f70", "#ea7375", "#eb8779", …]
```
Or more:
Using two colors and default (10) midpoints to return single hex color value corresponding to the provided index:

@@ -67,3 +74,6 @@ ```javascript

colorGradient.setGradient("#3F2CAF", "#e9446a", "#edc988", "#607D8B");
const colorAtTwo = colorGradient.setGradient("#3F2CAF", "e9446a").getColor(2);
console.log(colorAtTwo);
// #502ea8
```

@@ -70,0 +80,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