2
Imagine I have an element div
with the following CSS:
.minha-div{
width:100px;height:100px;
background:linear-grandient(45deg, orange, red);
}
It’s possible that when I hover over that div
, it tells me which pixel color the mouse is on top of, using Javascript / jQuery?
I’ve managed to define the mouse position in the colored block, but I can’t imagine a way to get the color in that exact position.
Example of what has already been done: FIDDLE
It is worth using a separate equation (doing a manual linear interpolation to find the color)?
– carlosrafaelgn
What kind of content do you have in this div? If it’s just an image, you can use a canvas. Then it’s easier to get the color.
– lfarroco
The idea is to create a kind of color-Picker own, but with CSS, so the content of this
div
would be the same, but colors may change.– Kazzkiq