Pick colors from within iframe

Is it possible to pick colors from an iframe using some kind of eyedropper in JavaScript or jQuery? Both the page (that contains iframe) and iframe are on the same domain. Thanks for any ideas.


Sure it’s possible.
I’ve thrown together a little example here: http://hibbard.eu/blog/pages/iframe-color-picker/

I’ve used sstrudeau’s jquery-dropper plugin to implement the eye-dropper.
I’ve then taken his basic demo, stuck the images etc within an iframe and tweaked the code a little.

If you have a look at the page source, you should be able to see what’s going on.
If you have any questions, just let me know.
If it helps, I can also send you the files.

It looks nice but in my application the color picker is outside of the iframe. Besides, my iframe does not consist only of images, it is a web page preview.

Glad you like it :slight_smile:
It was just a demo to answer your original question of whether this is possible.
If you can find a colour-picker (eye-dropper??) that allows you to pick colours from anywhere on the page, I can help you implement it in an iframe.

Well, I have been looking for that (a colour-picker that allows you to pick colors from anywhere on the page) but I couldn’t find one. Maybe it is not possible and that’s why there are no scripts to do that.