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

Set color "programmatically"? #224

Open
chesterlaykin opened this issue Feb 26, 2021 · 1 comment
Open

Set color "programmatically"? #224

chesterlaykin opened this issue Feb 26, 2021 · 1 comment

Comments

@chesterlaykin
Copy link

Hello,

How can I load a color programmatically, for instance "#a8efa8" ?

My vue component looks like:
<sketch-picker v-on-clickaway="away" v-if="colorEditor" :value="bgColor.value" @input="$emit('input',$event)" />

It loads any existing saved value, which is an object of many color codes (hsl, hsv, hex etc).
But if there is no existing value, I would like to set a value just by loading a hex value ("#a8efa8") , but how can I do it?

It works if I create an object with all the values (hsl, hsv etc), and set it to my form property. But that's a lot of code for one color, so it would be more convenient if I can input a hex value and get the object in return somehow?

@hurradieweltgehtunter
Copy link

hurradieweltgehtunter commented Apr 27, 2021

workaround: add a v-if="status === 'idle'" on the color picker. Then:
status = 'loading'
color = '#asdasd'
status = 'idle'

Color picler gets re-initialized and has the color set

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

No branches or pull requests

2 participants