Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
dojo.require("dojo.html.style");
14
dojo.provide("dojo.html.color");
15
dojo.require("dojo.gfx.color");
16
dojo.require("dojo.lang.common");
17
dojo.html.getBackgroundColor = function (node) {
18
	node = dojo.byId(node);
19
	var color;
20
	do {
21
		color = dojo.html.getStyle(node, "background-color");
22
		if (color.toLowerCase() == "rgba(0, 0, 0, 0)") {
23
			color = "transparent";
24
		}
25
		if (node == document.getElementsByTagName("body")[0]) {
26
			node = null;
27
			break;
28
		}
29
		node = node.parentNode;
30
	} while (node && dojo.lang.inArray(["transparent", ""], color));
31
	if (color == "transparent") {
32
		color = [255, 255, 255, 0];
33
	} else {
34
		color = dojo.gfx.color.extractRGB(color);
35
	}
36
	return color;
37
};
38