All Projects → Adrinlol → javascript-color-gradient

Adrinlol / javascript-color-gradient

Licence: MIT license
Lightweight JavaScript library, used to generate an array of color gradients, between start and finish colors.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to javascript-color-gradient

Colorpicker
jQuery UI widget for color picking (similar to the one in Microsoft Office 2010).
Stars: ✭ 271 (+401.85%)
Mutual labels:  color, palette, color-picker, color-palette
pantone-colors
Hex values of all 2310 Pantone colors
Stars: ✭ 147 (+172.22%)
Mutual labels:  color, palette, color-picker, color-palette
vscode-color
Helper with GUI to generate color codes such as CSS color notations.
Stars: ✭ 88 (+62.96%)
Mutual labels:  palette, color-picker, color-palette
Chromacolorpicker
🎨 An intuitive iOS color picker built in Swift.
Stars: ✭ 434 (+703.7%)
Mutual labels:  color, color-picker, color-palette
R Color Palettes
Comprehensive list of color palettes available in r ❤️🧡💛💚💙💜
Stars: ✭ 708 (+1211.11%)
Mutual labels:  color, palette, color-palette
hcv-color
🌈 Color model HCV/HCG is an alternative to HSV and HSL, derived by Munsell color system, usable for Dark and Light themes... 🌈
Stars: ✭ 44 (-18.52%)
Mutual labels:  color, palette, color-palette
SwiftColorWheel
Delightful color picker wheel for iOS in Swift.
Stars: ✭ 37 (-31.48%)
Mutual labels:  color, color-picker, color-palette
Md Color Picker
Angular-Material based color picker
Stars: ✭ 253 (+368.52%)
Mutual labels:  palette, color-picker, color-palette
Leonardo
Generate colors based on a desired contrast ratio
Stars: ✭ 973 (+1701.85%)
Mutual labels:  color, color-picker, color-palette
Colors App
🎨 A PWA for copying values from popular color palettes. Supports HEX, RGB, and HSL formats.
Stars: ✭ 90 (+66.67%)
Mutual labels:  color, color-picker, color-palette
Colorbook
🎨 Color schemes for UI design - Optimized for foreground, background, border, etc. https://liyasthomas.github.io/colorbook
Stars: ✭ 148 (+174.07%)
Mutual labels:  color, color-picker, color-palette
Pickr
🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!
Stars: ✭ 3,759 (+6861.11%)
Mutual labels:  color, color-picker, color-palette
Kallewheel
A custom color wheel extension for Adobe Photoshop
Stars: ✭ 16 (-70.37%)
Mutual labels:  color, color-picker, color-palette
react-native-image-color-picker
Image color picker based on image source provided and return image different color palettes or average color palette
Stars: ✭ 25 (-53.7%)
Mutual labels:  color, color-picker, color-palette
react-native-color-panel
React Native Color Panel Component for iOS and Android 🏳️‍🌈
Stars: ✭ 21 (-61.11%)
Mutual labels:  color, color-picker, color-palette
colr pickr
Colr Pickr, a vanilla JavaScript color picker component built with SVGs, with features like saving colors. Similar design to the chrome-dev-tools color picker.
Stars: ✭ 27 (-50%)
Mutual labels:  color, color-picker
global-color-picker
start the script and click anywhere to get rgb value at the cursor location
Stars: ✭ 31 (-42.59%)
Mutual labels:  color, color-picker
color-loader
🎨 A webpack loader that extracts the color palette of an image
Stars: ✭ 14 (-74.07%)
Mutual labels:  color, color-palette
imgpalr
R package for generating color palettes from arbitrary images.
Stars: ✭ 44 (-18.52%)
Mutual labels:  color, color-palette
reinvented-color-wheel
A vanilla-js touch-friendly HSV color picker inspired by Farbtastic Color Picker.
Stars: ✭ 43 (-20.37%)
Mutual labels:  color, color-picker

JavaScript Color Gradient

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.

MIT License Version Size

Installation

For Node.js: Install the javascript-color-gradient npm module:

npm install javascript-color-gradient

Then import the module into your JavaScript:

import Gradient from "javascript-color-gradient";

Demo

A demo is worth a thousand words.

Note: All the examples are using ES6, be sure is supported in your browser or modify as needed, Chrome recommended.

Methods

Method Description
setColorGradient() Initializes {Gradient} with two or more hex color values. Should always be defined.
setMidpoint(n) Defines number of midpoints. Defaults to 10.
getColors() Returns an array of hex color values .
getColor(n) Returns single hex color value corresponding to the provided index.

Usage

Using 2 colors and default (10) midpoints to generate an array of hex color values:

import Gradient from "javascript-color-gradient";

const gradientArray = new Gradient()
  .setColorGradient("#3F2CAF", "e9446a")
  .getColors();

console.log(gradientArray);
// ["#502ea8", "#6131a1", "#72339a", "#833693", "#94388d", "#a53a86", "#b63d7f", "#c73f78", "#d84271", "#e9446a"]

Using 4 colors and 20 midpoints to generate an array of hex color values :

import Gradient from "javascript-color-gradient";

const gradientArray = new Gradient()
  .setColorGradient("#3F2CAF", "#e9446a", "#edc988", "#607D8B")
  .setMidpoint(20)
  .getColors();

console.log(gradientArray);
// ["#5930a5", "#72339a", "#8c3790", "#a53a86", "#bf3e7b", "#d84271", "#e94b6c", "#ea5f70", "#ea7375", "#eb8779", …]

Using two colors and default (10) midpoints to return single hex color value corresponding to the provided index:

import Gradient from "javascript-color-gradient";

const colorAtIndexTwo = new Gradient()
  .setColorGradient("#3F2CAF", "e9446a")
  .setMidpoint(20)
  .getColor(2);

console.log(colorAtIndexTwo);
// #5930a5

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

javascript-color-gradient is MIT licensed.

Contributors

Special thanks to all the contributors who have contributed for this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].