Get last version!: get_color.js
Sometimes you want to get the color of some part of a web page. Here you can see my script called
Color Picker
This is an example:
This is the example code:
<style type="text/css">
h1 {
color: #ffff00;
background: #ffdddd;
border:3px solid;
border-bottom-color:#0000FF;
border-left-color:#00CC00;
border-right-color:#FF0000;
border-top-color:transparent;
}
</style>
<body>
<h1 id="h1">
<p style="color:#00ccff;">hello I'm a <p> tag into a <h1> tag</p>
</h1>
</body>
and this is what you get from my script
First, click over
P object:
Second, click out
P but inside
H1 object
as you can see there is a <p> tag into a <h1> tag, and <p> has no background, but it don't care, what you want to know is the background color that you are seeing. so if some element has transparent background the code check parentNodes until get some color background.
another thing is that you have the four borders, as you can see in the last picture, you can click over each little part to get the hexadecimal values.
Finally, how to use?
First of all, you have to click over the object you want, but maybe it's a link... so:
1. You have to just drop the mouse over the object. (Don't care where you clicked first)
2. Then you have to execute cp_getColor() function. So, you can put a button or some item into a context menu, like this:
Item, "Color Picker"="Go to Page,"javascript:cp_getColor()""
If you have inserted it into a context menu, you can right-click over anything, because Opera doesn't allow to check right-buttons events.