mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-14 21:04:53 +00:00
Monotone-Parent: 4da2e2aa68da3f6c69bddae3167041872607c9d2
Monotone-Revision: 589cbe87a5260166298c57c4fa50494edb7b9fbd Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-04-22T17:16:37 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -307,6 +307,23 @@ function onAjaxRequestStateChange(http) {
|
||||
}
|
||||
}
|
||||
|
||||
/* taken from Lightning */
|
||||
function getContrastingTextColor(bgColor) {
|
||||
var calcColor = bgColor.substring(1);
|
||||
var red = parseInt(calcColor.substring(0, 2), 16);
|
||||
var green = parseInt(calcColor.substring(2, 4), 16);
|
||||
var blue = parseInt(calcColor.substring(4, 6), 16);
|
||||
|
||||
// Calculate the brightness (Y) value using the YUV color system.
|
||||
var brightness = (0.299 * red) + (0.587 * green) + (0.114 * blue);
|
||||
|
||||
// Consider all colors with less than 56% brightness as dark colors and
|
||||
// use white as the foreground color, otherwise use black.
|
||||
return ((brightness < 144)
|
||||
? "white"
|
||||
: "black");
|
||||
}
|
||||
|
||||
function triggerAjaxRequest(url, callback, userdata, content, headers) {
|
||||
var http = createHTTPClient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user