PDA

View Full Version : Eye Dropper


Mr J
05-15-2003, 09:13 PM
Is it possible, with Javascript, to create an eye dropper to use within a webpage to determine the colour of a pixel?

Algorithm
05-15-2003, 10:39 PM
Only if the entire page was generated by Javascript, used only pixel values, and contained no text or images. :( Sorry.

liorean
05-15-2003, 11:00 PM
Almost as hard as Algorithm said. You can't determine colour from foreground or images, or the total of an alpha transparency, but you CAN determine border/background-color on any element, and it doesn't have to be positioned in any special way either. If it's transparent or inherit, however, you'll have problems determining it.

(You can't find out if you're over the foreground or background, and you can't determine the colour properties of replaced elements with inherent colouring scheme.)