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

@simonwep/pickr

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simonwep/pickr

Flat, Simple, Hackable Color-Picker.

  • 1.9.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49K
decreased by-57.64%
Maintainers
1
Weekly downloads
 
Created

What is @simonwep/pickr?

@simonwep/pickr is a highly customizable color picker library for JavaScript. It allows users to select colors in various formats (HEX, RGB, HSV, etc.) and provides a user-friendly interface with multiple themes and options for integration into web applications.

What are @simonwep/pickr's main functionalities?

Basic Color Picker

This code initializes a basic color picker with a classic theme and a set of predefined swatches. It also enables various color formats and interaction options.

const pickr = Pickr.create({
  el: '.color-picker',
  theme: 'classic',
  swatches: [
    'rgba(244, 67, 54, 1)',
    'rgba(233, 30, 99, 0.95)',
    'rgba(156, 39, 176, 0.9)',
    'rgba(103, 58, 183, 0.85)',
    'rgba(63, 81, 181, 0.8)',
    'rgba(33, 150, 243, 0.75)',
    'rgba(3, 169, 244, 0.7)',
    'rgba(0, 188, 212, 0.7)',
    'rgba(0, 150, 136, 0.75)',
    'rgba(76, 175, 80, 0.8)',
    'rgba(139, 195, 74, 0.85)',
    'rgba(205, 220, 57, 0.9)',
    'rgba(255, 235, 59, 0.95)',
    'rgba(255, 193, 7, 1)'
  ],
  components: {
    preview: true,
    opacity: true,
    hue: true,
    interaction: {
      hex: true,
      rgba: true,
      hsla: true,
      hsva: true,
      cmyk: true,
      input: true,
      clear: true,
      save: true
    }
  }
});

Inline Color Picker

This code initializes an inline color picker with a monolith theme. The picker is displayed inline rather than as a popup, making it suitable for embedding directly within a page layout.

const pickr = Pickr.create({
  el: '.color-picker',
  theme: 'monolith',
  inline: true,
  components: {
    preview: true,
    opacity: true,
    hue: true,
    interaction: {
      hex: true,
      rgba: true,
      hsla: true,
      hsva: true,
      cmyk: true,
      input: true,
      clear: true,
      save: true
    }
  }
});

Color Picker with Custom Events

This code initializes a color picker with a nano theme and sets up a custom event listener for the 'save' event. When a color is saved, it logs the selected color in RGBA format to the console.

const pickr = Pickr.create({
  el: '.color-picker',
  theme: 'nano',
  components: {
    preview: true,
    opacity: true,
    hue: true,
    interaction: {
      hex: true,
      rgba: true,
      hsla: true,
      hsva: true,
      cmyk: true,
      input: true,
      clear: true,
      save: true
    }
  }
});

pickr.on('save', (color, instance) => {
  console.log('Color saved:', color.toRGBA().toString());
});

Other packages similar to @simonwep/pickr

Keywords

FAQs

Package last updated on 10 May 2024

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

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