metafizzy / huebee

🐝 1-click color picker
https://huebee.buzz
403 stars 43 forks source link

Update value even if color is not correct #37

Open Marfru opened 2 years ago

Marfru commented 2 years ago

Greetings,

I have an issue, I noticed that the color change function fires up only when the color is valid.

Is there a way to fire it up even if the inputted data is not a valid color?

For example, in the console.log(this.selectedColor), it only fires when the color is valid. Let's say I add #xxx87, it doesn't fire up. Is it possible to make it available even when the data is not a valid color?

if (!this.colorSelector) {
        const elem = this.$el.querySelector('.brand-color-input')
        this.colorSelector = new Huebee(elem,{
          notation: 'hex',
          saturations: 2,
        })
        this.colorSelector.on('change', (color) => {
          this.selectedColor = color
          this.colorIcon = elem.style.color
          this.$emit('input', this.selectedColor)
          console.log(this.selectedColor)
        })
      }