__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
/**
 * @copyright	Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved.
 * @license	GNU General Public License version 3 or later; see LICENSE.txt
 */
class ColourPicker extends HTMLElement {
  constructor() {
    super()

    this.swatch = ''
    this.input = ''
    this.panel = ''
  }

  connectedCallback() {

    // Create swatch
    this.swatch = document.createElement('colour-swatch')

    // Create panel
    this.panel = document.createElement('div')
    this.panel.classList.add('panel')

    // Append the elements
    this.appendChild(this.swatch)
    this.appendChild(this.panel)

    this.init()
  }
  
  init() {
    this.input = this.querySelector('input[type=text]');

    const defaultColour = this.input.value !== '' ? this.input.value : '#fff';
    const colorSpace = this.input.getAttribute('data-color-format') !== null ? this.input.getAttribute('data-color-format') : 'hex';
	
	let picker = null;

	if (colorSpace == 'rgba' || colorSpace == 'hex8') {
		this.querySelector('.panel').style.width = '230px';
		
	    picker = new iro.ColorPicker(this.panel, {
	      width: 150,
	      layoutDirection: 'horizontal',
	      color: defaultColour,
	      layout: [
			{
		      component: iro.ui.Box,
		    },
			{
		      component: iro.ui.Slider,
		      options: {
		        id: 'hue-slider',
		        sliderType: 'hue'
		      }
		    },
		    {
		      component: iro.ui.Slider,
		      options: {
		        sliderType: 'alpha'
		      }
		    },
		  ]
	    })
	} else if (colorSpace == 'rgb' || colorSpace == 'hex') {
		picker = new iro.ColorPicker(this.panel, {
	      width: 150,
	      layoutDirection: 'horizontal',
	      color: defaultColour,
	      layout: [
		    {
		      component: iro.ui.Box,
		    },
		    {
		      component: iro.ui.Slider,
		      options: {
		        id: 'hue-slider',
		        sliderType: 'hue'
		      }
		    }
		  ]
	    })
	} else if (colorSpace == 'hsla') {
		this.querySelector('.panel').style.width = '230px';
		
	    picker = new iro.ColorPicker(this.panel, {
	      width: 150,
	      layoutDirection: 'horizontal',
	      color: defaultColour,
	      layout: [
			{
		      component: iro.ui.Wheel,
		    },
			{
		      component: iro.ui.Slider,
		      options: {
		        sliderType: 'value'
		      }
		    },
		    {
		      component: iro.ui.Slider,
		      options: {
		        sliderType: 'alpha'
		      }
		    },
		  ]
	    })
	} else {
		picker = new iro.ColorPicker(this.panel, {
	      width: 150,
	      layoutDirection: 'horizontal',
	      color: defaultColour
	    })
	}

    picker.on(['color:change'], (color) => {
      
      switch(colorSpace) {
			case 'rgb': this.input.value = color.rgbString; this.swatch.style.backgroundColor = color.rgbString; break;
			case 'rgba': this.input.value = color.rgbaString; this.swatch.style.backgroundColor = color.rgbaString; break;
			case 'hsl': this.input.value = color.hslString; this.swatch.style.backgroundColor = color.hslString; break;
			case 'hsla': this.input.value = color.hslaString; this.swatch.style.backgroundColor = color.hslaString; break;
			case 'hex8': this.input.value = color.hex8String; this.swatch.style.backgroundColor = color.hex8String; break;
			default: this.input.value = color.hexString; this.swatch.style.backgroundColor = color.hexString;
		}
      
      this.input.dispatchEvent(new Event('input', { bubbles: true }))
    })

    picker.on(['color:init'], (color) => {
      this.swatch.style.backgroundColor = this.input.value
    })

    this.input.addEventListener('change', ({ target }) => {
      
		switch(colorSpace) {
			case 'rgb': picker.color.rgbString = target.value; break;
			case 'rgba': picker.color.rgbaString = target.value; break;
			case 'hsl': picker.color.hslString = target.value; break;
			case 'hsla': picker.color.hslaString = target.value; break;
			case 'hex8': picker.color.hex8String = target.value; break;
			default: picker.color.hexString = target.value;
		}
    })

    // If the swatch is clicked, trigger a focus on the input to open the panel
    this.swatch.addEventListener('click', () => {
      this.input.focus()
    })

    this.input.addEventListener('focus', () => {
      if (!this.panel.classList.contains('is-open')) {
        this.panel.classList.add('is-open')
      }
    })

    this.input.addEventListener('blur', () => {
      this.panel.classList.remove('is-open')
    })
  }
}

// Define the new element
customElements.define('colour-picker', ColourPicker)

Filemanager

Name Type Size Permission Actions
color-picker.js File 4.55 KB 0664
color-picker.min.js File 2.88 KB 0664
iro.js File 70.65 KB 0664
iro.min.js File 27.59 KB 0664
Filemanager