Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to put HEX in and get only the HEX out (no other color formats) #185

Open
range-of-motion opened this issue Sep 11, 2019 · 7 comments

Comments

@range-of-motion
Copy link

As the title says. When I say myHex: '#FF0000', and use that as the v-model, I expect the updated myHex variable to be a HEX code, not an object containing a HEX code (and other color formats).

Is this possible?

@Pixney-William
Copy link

If i undersand your question, then you can do this:

<chrome-picker @input="input" v-model="colors" />

and listen to it and get the value from it:

  methods: {
    input(color) {
      console.log(color.hex);
    }
  }

@sebbmeyer
Copy link

but if you have multiple color pickers on one page, that's not going to help, because every picker would need his own input method

@linx4200
Copy link
Collaborator

linx4200 commented Feb 27, 2020

Uniforming input and output format seems like a common request. Gonna think about it. But this is a breaking change, so if it takes not much efforts, will implement in 3.0 version.

@linx4200 linx4200 added the 3.0 label Feb 27, 2020
@range-of-motion
Copy link
Author

Yes please 😩

@downtest
Copy link

downtest commented Aug 6, 2020

Consider vue-select`s example in this case, they use reduce callback to pass only needed data to v-model
https://vue-select.org/guide/values.html#returning-a-single-key-with-reduce

@akicho8
Copy link

akicho8 commented Dec 5, 2020

I was troubled with the same problem.
As a result of trial and error, I wrote temporarily as follows.

data() {
  return {
    myHex: "#C6E1B880",
  }
}
<chrome-picker :value="myHex" @input="c => myHex = c.hex8" />

It is a pity that v-model can not be used very effectively

@Tofandel
Copy link

Tofandel commented Aug 4, 2021

You can also write <chrome-picker :value="myHex" @input="myHex = $event.hex8" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants