rydmike / flex_color_picker

A highly customizable Flutter color picker.
BSD 3-Clause "New" or "Revised" License
197 stars 41 forks source link

Is there a way to paste the color code in the color picker? #3

Closed Sheharyar566 closed 3 years ago

Sheharyar566 commented 3 years ago

Hi there,

Is there any way to paste an external color code in the color picker? For example, let's say I've got this color code "0xFF56AB32", and I want to paste color code in the color picker so that I get the same color picked (may be).

Thanks

rydmike commented 3 years ago

Hi, thanks for the question.

Yes you can, but only on the Wheel picker page/tab, and it needs to be configured to show the color code showColorCode: true.

In the code display field, that on the Wheel picker page is also an RGB code entry field, you can paste in the RGB part, so in your example "56AB32" and the Wheel controls will move to the new code, just as if you would have entered it. Before you paste you need to select the text (desktop/web double click the field) to be replace all current text with the paste operation.

image

Pasting "56AB32" with CTRL-V on browser in Windows...

image

I know, it is not so intuitive and actually just a side effect of the code text entry field, but it works and I use it a lot myself too.

I'm planning to add support for transparency to the Wheel picker page. I will see about the possibility to handle paste action better too at the same time when I do that.

I'm thinking it could be possible to make it so that if you paste a string, then if the pasted String can be parsed to a color value, it automatically moves to the Wheel page (if present in the Picker setup and if not there already), uses the parsed color value to update the Wheel picker color. That should be a bit easier to use.

For the parsing of the string it will be able to handle color hex RGB strings with or without alpha and with or without the Flutter leading hex indicator "0x" or a "#" char that is typical on web color strings.

rydmike commented 3 years ago

Since the question was answered and there even is a way to paste the color code, I'm closing the question. But I will still look into ways to improve it, as described above.

Sheharyar566 commented 3 years ago

thanks a lot my friend for this awesome plugin and for answering my query :)

jaxnz commented 3 years ago

Just want to add that this package is the only one that accepts manual hex entry, saved my life!

rydmike commented 3 years ago

Thanks @jaxnz glad if it is useful to others too. I needed and use the HEX RGB entry a lot myself too. 😃