Javascript "Eyedropper" (pulls color of a pixel off a page)

R

Richard Cornford

Weston said:
Is there any way to use javascript to pull the color of
the pixel under the mouse pointer off the page?

Not really. You, with more or less ease, could work out which element
the mouse was over, and then, on browsers providing a computed style
interface, determine the text, background and border colours of that
element. But telling whether the pointer was over text or the background
or a border would not be easy (and borders may still be inset, outset,
etc and so not necessarily the declared colour under the pointer). And
there would be no chance with images (including background images).

Richard.
 
F

Fred Oz

In said:
Not really. You, with more or less ease, could work out which element
<snip>

Absolutely none, particularly off the page. You can try to do what
Richard says, except that will not allow for shadows, anti-aliasing, etc.
and even if you could do it, it will not work off the page since your
document must be inside a window.

You can do it with a Java applet maybe, but this is not the place to ask
such things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top