New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gpickr

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpickr

> THIS IS A FORKED PACKAGE FROM simonwep THANKS TO HIM.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

THIS IS A FORKED PACKAGE FROM simonwep THANKS TO HIM.

Demo: https://simonwep.github.io/gpickr

This is a demo of how pickr could be implemented / integrated in other scenarios.

Usage

const gpickr = new GPickr({
    el: '.gradient-pickr',

    // Pre-defined stops. These are the default since at least two should be defined
    stops: [
        ['rgb(255,132,109)', 0],
        ['rgb(255,136,230)', 1]
    ]
})

GPickr Instance / static props

  • gpickr.Pickr - Pickr.
  • gpickr.addStop(color:String, loc:Number) - Add a color-stop.
  • gpickr.removeStop(v:String|Number|Stop) - Remove a color stop by color, location or stop-instance.
  • gpickr.getGradient() - Returns the current gradient as css string.
  • gpickr.getStops() - Array of stop objects with each a location between 0 and 1 as well as an rgba color value. The toString function is overridden and returns the array ready-to-use as comma seperated list, useful if a custom direcation / angle want to be used.
  • gpickr.getLinearAngle() - Returns the current selected angle. -1 if currently in radial-mode
  • gpickr.setLinearAngle(angle:Number) - Applies a new angle to the current linear gradient.
  • gpickr.getRadialPosition() - Returns the current chosen direction. null if currently in linear-mode
  • gpickr.setRadialPosition(position:String) - Sets a new position for the current radial-gradient.
  • gpickr.on(event:String, cb:Function) - Appends an event listener to the given corresponding event-name (see section Events), returns the gpickr instance so it can be chained.
  • gpickr.off(event:String, cb:Function) - Removes an event listener from the given corresponding event-name (see section Events), returns the gpickr instance so it can be chained.

Events

EventDescription
initInitialization done - gpickr can be used
changeUser changed the gradient

Example:

gpickr.on('init', instance => {
    console.log('init', instance);
}).on('change', instance => {
    console.log('change', instance.getGradient());
});

FAQs

Package last updated on 24 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts