0.8.22 • Published 3 years ago

@pluginjs/color-selector v0.8.22

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 years ago

ColorSelector

npm package

A flexible modern color-selector js plugin.

Samples

Introduction

Installation

Yarn

yarn add @pluginjs/color-selector

NPM

npm i @pluginjs/color-selector

Getting Started

CDN:

Development:

<script src="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.css">

Production:

<script src="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.min.css">

Initialize

HTML:

<div class="element"></div>

ECMAScript Module:

import ColorSelector from "@pluginjs/color-selector"
import "@pluginjs/color-selector/dist/color-selector.css"

ColorSelector.of(document.querySelector('.element'), options)

CommonJS:

require("@pluginjs/color-selector/dist/color-selector.css")
const ColorSelector = require("@pluginjs/color-selector")

ColorSelector.of(document.querySelector('.element'), options)

Browser:

<link rel="stylesheet" href="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.css">
<script src="https://unpkg.com/@pluginjs/color-selector/dist/color-selector.js"></script>
<script>
  Pj.colorSelector('.element', options)
</script>

API

Options

Options are called on colorSelector instances through the colorSelector options itself. You can also save the instances to variable for further use.

NameDescriptionDefault
"theme"Set plugin theme optionnull
"locale"Set locale environmenten
"placeholder"Set input box prompt informationchoose color
"module"Set plugin module option["collection","solid","gradient"]
"solidMode"Set plugin solidMode optionfull
"solidModule"Set plugin solidModile option{"saturation":true,"hue":true,"alpha":true,"hex":true}
"gradientMode"Set plugin gradientMode optionlinear
"defaultColor"Set plugin defaultColor option#000
"data"Set plugin data optionnull
"color"Set plugin color option{"format":false,"alphaConvert":{"RGB":"RGBA","HSL":"HSLA","HEX":"RGBA","NAMESPACE":"RGBA"},"shortenHex":false,"hexUseName":false,"reduceAlpha":true,"nameDegradation":"HEX","invalidValue":"","zeroAlphaAsTransparent":true}
"manage"Set plugin manage optionfunction() {...}
"templates"Set default templates{}
"process"The type of object change the type of JSONfunction() {...}
"parse"The type of JSON change the type of objectfunction() {...}

Events

Events are called on colorSelector instances through the colorSelector events itself. You can also save the instances to variable for further use.

NameDescription
"update"Gets fired when plugin has destroy
"ready"Gets fired when plugin has ready
"enable"Gets fired when plugin has enabled
"disable"Gets fired when plugin has disabled
"destroy"Gets fired when plugin has destroy
"change"Gets fired when plugin has changed
"openPanel"Gets fired when plugin has openPanel
"switchModule"Gets fired when plugin has switchModule

Methods

Methods are called on colorSelector instances through the colorSelector method itself. You can also save the instances to variable for further use.

NameDescription
"enable"Enabled plugin if plugin is disabled
"disable"Disable plugin
"get"Get value by key
"set"Set value by key
"update"Update plugin

Classes

Name | Description | Default --|| "NAMESPACE" | Declare plugin namespace | pj-colorSelector "THEME" | Declare plugin theme | {namespace}--{theme} "ELEMENT" | Declare plugin element | {namespace} "WRAP" | Declare plugin wrap | {namespace}-wrap "TRIGGER" | Declare plugin trigger | {namespace}-trigger "DISABLED" | Announce plugin is disabled | {namespace}-disabled "INPUT" | Declare plugin input | {namespace}-input "REMOVE" | Declare plugin remove | {namespace}-remove "MASK" | Declare plugin mask | {namespace}-mask "PREVIEW" | Declare plugin preview | {namespace}-preview "PREVIEWCOLOR" | Declare plugin preview color | {namespace}-preview-color "PREVIEWBG" | Declare plugin preview bg | {namespace}-preview-bg "PANEL" | Declare plugin panel | {namespace}-panel "OPENPANEL" | Declare plugin open | {namespace}-open "PANELWRAP" | Declare plugin panel wrap | {namespace}-panel-wrap "PANELTRIGGER" | Declare plugin panel trigger | {namespace}-panel-trigger "PANELTRIGGERCOLLECTION" | Declare plugin panel trigger collection | {namespace}-panel-trigger-collection "PANELTRIGGERSOLID" | Declare plugin panel trigger solid | {namespace}-panel-trigger-solid "PANELTRIGGERGRADIENT" | Declare plugin panel trigger gradient | {namespace}-panel-trigger-gradient "PANELCONTAINER" | Declare plugin panel container | {namespace}-panel-container "PANELCOLLECTION" | Declare plugin panel collection | {namespace}-panel-collection "PANELSOLID" | Declare plugin panel solid | {namespace}-panel-solid "PANELGRADIENT" | Declare plugin panel gradient | {namespace}-panel-gradient "SELECTED" | Declare plugin selected | {namespace}-selected "SOLIDHANDLE" | Declare plugin solid handle | {namespace}-solid-handle "SOLIDPRIMARY" | Declare plugin solid primary | {namespace}-solid-primary "SOLIDACTION" | Declare plugin solid action | {namespace}-solid-action "CONTRAST" | Declare plugin contrast | {namespace}-contrast "CONTRASTNOW" | Declare plugin contrast now | {namespace}-contrast-now "CONTRASTPREV" | Declare plugin contrast prev | {namespace}-contrast-prev "HISTORY" | Declare plugin history | {namespace}-history "HISTORYITEM" | Declare plugin history item | {namespace}-history-item "FAVORITES" | Declare plugin favorites | {namespace}-favorites "SCHEME" | Declare plugin scheme | {namespace}-scheme "GROUPTITLE" | Declare plugin group title | {namespace}-group-title "GROUPLIST" | Declare plugin group list | {namespace}-group-list "COLLECTIONITEM" | Declare plugin collection item | {namespace}-collection-item "MANAGE" | Declare plugin manage | {namespace}-manage "COLLECTIONSCROLLWRAP" | Declare plugin collection scroll wrap | {namespace}-collection-scrollwrap "POINTER" | Declare plugin pointer | {namespace}-pointer "ALPHA" | Declare plugin alpha | {namespace}-alpha "HUE" | Declare plugin hue | {namespace}-hue "HEX" | Declare plugin hex | {namespace}-hex "SATURATION" | Declare plugin saturation | {namespace}-saturation "CANCEL" | Announce plugin is cancel | {namespace}-cancel "OK" | Announce plugin is ok | {namespace}-ok "GRADIENTHANDLE" | Declare plugin gradient handle | {namespace}-gradient-handle "GRADIENTPRIMARY" | Declare plugin gradient primary | {namespace}-gradient-primary "GRADIENTACTION" | Declare plugin gradient action | {namespace}-gradient-action "GRADIENTBAR" | Declare plugin gradient bar | {namespace}-gradient-bar "GRADIENTBARVIEW" | Declare plugin gradient bar view | {namespace}-gradient-bar-view "GRADIENTCONTENT" | Declare plugin gradient content | {namespace}-gradient-content "GRADIENTREMOVE" | Declare plugin gradient remove | {namespace}-gradient-remove "GRADIENTREMOVEACTIVE" | Declare plugin gradient remove active | {namespace}-gradient-remove-active "GRADIENTMODE" | Declare plugin gradient mode | {namespace}-gradient-mode "MARKER" | Declare plugin marker | {namespace}-marker "MARKERACTIVE" | Declare plugin marker active | {namespace}-marker-active "WHEEL" | Declare plugin wheel | {namespace}-wheel "WHEELHANDLE" | Declare plugin wheel handle | {namespace}-wheel-handle "WHEELANGLE" | Declare plugin wheel angle | {namespace}-wheel-angle

Translations

Name | EN | ZH --||- "ok" | ok | 保存 "cancel" | Cancel | 取消 "manage" | Manage | 管理 "collection" | Collection | 收藏 "solid" | Solid | 纯色 "gradient" | Gradient | 渐变 "colorInScheme" | COLORS IN SCHEME | 颜色格式 "myColors" | MY COLORS | 我的颜色

Browser support

Tested on all major browsers.

IE / EdgeFirefoxChromeSafariOpera
IE11, Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versions

License

@pluginjs/color-selector is Licensed under the GPL-v3 license.

If you want to use @pluginjs/color-selector project to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary.

For purchase an Commercial License, contact us purchase@thecreation.co.

Copyright

Copyright (C) 2022 Creation Studio Limited.

0.8.22

3 years ago

0.8.21

3 years ago

0.8.20

3 years ago

0.8.16

4 years ago

0.8.15

4 years ago

0.8.14

5 years ago

0.8.13

5 years ago

0.8.12

5 years ago

0.8.11

5 years ago

0.8.10

5 years ago

0.8.9

5 years ago

0.8.8

5 years ago

0.8.7

5 years ago

0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.7.43

5 years ago

0.7.40

6 years ago

0.7.41

5 years ago

0.7.39

6 years ago

0.7.38

6 years ago

0.7.37

6 years ago

0.7.36

6 years ago

0.7.34

6 years ago

0.7.33

6 years ago

0.7.32

6 years ago

0.7.31

6 years ago

0.7.30

6 years ago

0.7.29

6 years ago

0.7.28

6 years ago

0.7.27

6 years ago

0.7.26

6 years ago

0.7.25

6 years ago

0.7.24

6 years ago

0.7.23

6 years ago

0.7.22

6 years ago

0.7.21

6 years ago

0.7.20

6 years ago

0.7.19

6 years ago

0.7.18

6 years ago

0.7.17

6 years ago

0.7.16

6 years ago

0.7.15

6 years ago

0.7.14

6 years ago

0.7.13

6 years ago

0.7.12

6 years ago

0.7.11

6 years ago

0.7.10

6 years ago

0.7.9

6 years ago

0.7.8

6 years ago

0.7.7

6 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.0

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.1

7 years ago