npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@r2-d1/colorpicker

v1.0.9

Published

simple colorpicker and gradient picker

Downloads

14

Readme

EasyLogic ColorPicker

EasyLogic ColorPicker is vanila-js colorpicker.

License: MIT

NPM

Document Site: https://colorpicker.easylogic.studio/#colorpicker-for-standalone

Demo

https://codepen.io/redgoose/pen/BaRaqEd

Install

npm install @easylogic/colorpicker

Using

module

import ColorPicker, {GradientPicker} from '@easylogic/colorpicker';
import '@easylogic/colorpicker/dist/EasyLogicColorPicker.css';

const picker = new ColorPicker({
  container: document.getElementById('basic'),
});

const gradientPicker = new GradientPicker({
  container: document.getElementById('gradient-picker'),
})

browser

<link href="https://cdn.jsdelivr.net/npm/@easylogic/[email protected]/dist/colorpicker.css" />
<div id="picker"></div>
<script src="https://cdn.jsdelivr.net/npm/@easylogic/[email protected]/dist/colorpicker.min.js"></script>

<script>
window.picker = new EasyLogicColorPicker({
  container: document.getElementById('picker'),
})
</script>

Initialize

import ColorPicker from '@easylogic/colorpicker';
const picker = new ColorPicker({
  container: document.getElementById('picker'),
  onInit: function(self) { console.log('initial colorpicker'); },
});

Component Options

refer to colorpicker javascript for detail

new ColorPicker({
  container,
  type: 'circle',
  color: 'lime',
  onChange: function(color) {
    console.log('change color', color);
  },
})
new GradientPicker({
  container,
  gradient: "linear-gradient(to right, white 0%, black 100%)",
  colorpicker: {
    type: "circle",
  },
  onChange: function(gradient) {
    console.log('change gradient', gradient);
  },
})

container

  • required
  • type: Element
  • default: undefined

The element where the color picker is inserted is determined by the selector.

ex) document.querySelector('#picker'), document.getElementById('picker')

type

  • type: string
  • default: null
  • value: default,circle,ring,mini,none

color picker theme design

color

  • type: string
  • default: #ffffff

Color code used for initialization

format

  • type: string
  • default: hex
  • value: hex,rgb,hsl

The color format used when initializing

outputFormat

  • type: string
  • default: undefined
  • value: hex,rgb,hsl

Color format output by callback function

useInformation

  • type: boolean
  • default: true

Whether to use the form area where the color code is displayed

useOpacity

  • type: boolean
  • default: true

투명도를 조절하는 슬라이더를 사용할지에 대한 여부를 정합니다.

paletteWidth

  • type: number
  • default: 200

Pallet width. It may not be available depending on the design type.

paletteHeight

  • type: number
  • default: undefined

palette vertical. It may not be available depending on the design type.

paletteThickness

  • type: number
  • default: 16

Thickness of circular pallet in design ring type

swatchTitle

  • type: string
  • default: Color palette

title of color swatch

swatchColors,

  • type: array
  • default: []
  • value: ['#ff0000', '#00ff00', '#0000ff']

Color list in color swatches

onInit

  • type: function
  • params: this: EasylogicColorPickere

Executed when the color picker is initialized.

onChange

  • type: function
  • params: color: string

Executes when the color changes. ex) mousemove, touchmove

onChanged

  • type: function
  • params: color: string

Executes when the color change ends. ex) mouseup, touchend

onChangeFormat

  • type: function
  • params: format: string

It is executed when the color format is changed.

onDestroy

  • type: function

Executed when the color picker object disappears.

Methods

You can use the color picker instance object to perform specific actions.

initialize

picker.initialize();

Initialize the instance. You can use it after executing destroy().

getColor

let color = picker.getColor();

Gets the selected color.

setColor

picker.setColor('#A6341B');

Change color.

setOption

picker.setOption({
  type: 'ring',
  color: '#00ff00',
});

Change options. Restart the color picker when making changes.

setType

picker.setType('circle');

Change the color picker design type. For the type value, refer to the type section. (Some set values ​​may disappear.)

destroy

picker.destroy();

Destroy the instance object.

Stylesheet

You can edit the color picker style directly by referring to the colorpicker stylesheet page.

Developments

Prepare the development environment with the following process.

git clone https://github.com/easylogic/easylogic-colorpicker
cd colorpicker
npm install
cp resource/.env ./

open local server

npm run dev

build

npm run build

.env

.env file can be used by modifying some of the local server options. You can tweak things like port numbers and server status by editing the .env file.

Contributors

  • easylogic
  • redgoose

License : MIT