How to use the @simonwep/pickr.create function in @simonwep/pickr

To help you get started, we’ve selected a few @simonwep/pickr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Simonwep / gpickr / src / js / gpickr.js View on Github external
// Build dom
        this._root = buildGPickr(opt);

        // Check if conic-gradient is supported
        if (CSS.supports('background-image', 'conic-gradient(#fff, #fff)')) {
            this._modes.push('conic');
        }

        opt.el = opt.el.split(/>>/g).reduce((pv, cv, ci, a) => {
            pv = pv.querySelector(cv);
            return ci < a.length - 1 ? pv.shadowRoot : pv;
        }, document);

        opt.el.parentElement.replaceChild(this._root.root, opt.el);

        this._pickr = Pickr.create({
            el: this._root.pickr,
            theme: 'nano',
            inline: true,
            useAsButton: true,
            showAlways: true,
            defaultRepresentation: 'HEXA',

            components: {
                palette: true,
                preview: true,
                opacity: true,
                hue: true,

                interaction: {
                    input: true
                }
github vanilla / vanilla / library / src / scripts / forms / themeEditor / ThemeColorPicker.tsx View on Github external
const createAndOpen = useCallback(() => {
        if (!ref.current) {
            return;
        }

        if (pickrRef.current) {
            return;
        }

        const pickr = Pickr.create({
            el: ref.current,
            theme: "nano",
            outputPrecision: 0,
            useAsButton: true,
            default: currentColorRef.current,
            components: {
                // Main components
                preview: true,
                hue: true,

                // Input / output Options
                interaction: {
                    input: true,
                },
            },
        });
github fusioncms / fusioncms / fusion / resources / js / components / Importer / Fields / Color.vue View on Github external
mounted() {
			this.pickr = Pickr.create({
				el: '.' + this.mapping.handle + '-pickr',
				theme: 'monolith',
				default: this.mapping.default,
				comparison: true,
				components: {
                    opacity: this.settings.transparency,
                    hue: true,
                }
            }).on('save', (color, instance) => {
                this.pickrChanged(color)
            }).on('change', (color, instance) => {
                this.pickrChanged(color)
            }).on('clear', (instance) => {
                this.pickrChanged(null)
            })
github fusioncms / fusioncms / fusion / resources / js / fieldtypes / ColorPicker / Field.vue View on Github external
mounted() {
            let defaultColor = this.value === null && this.field.settings.default ? this.field.settings.default : ''

            this.pickr = Pickr.create({
                el: '.' + this.pickrClass,
                theme: 'monolith',
                default: this.value && this.value != '' ? this.value : defaultColor,
                swatches: [
                    '#000000',
                    '#FFFFFF',
                    
                    '#F7FAFC',
                    '#EDF2F7',
                    '#E2E8F0',
                    '#CBD5E0',
                    '#A0AEC0',
                    '#718096',
                    '#4A5568',
                    '#2D3748',

@simonwep/pickr

Flat, Simple, Hackable Color-Picker.

MIT
Latest version published 7 months ago

Package Health Score

72 / 100
Full package analysis