1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* colorRules.json
*
* Simple rules for checking that the colors of specific elements are in a specific set.
* Test using exampleData/basic/testColorRules.html
*/
{ 'name': "Color Guidelines"
, 'description': "Foreground/background color guidelines"
, 'rules': [
//----------------------------------------------------------------
{ 'name': "Foreground check"
, 'description': "Foreground colors should be in a certain fixed set."
, 'rule':
function () {
var allow = "rgb(0, 0, 0);" +
"rgb(255, 255, 255);" +
"rgb(85, 85, 85);" +
"rgb(34, 34, 34);" +
"rgb(187, 0, 0);" +
"rgb(238, 238, 238);" +
"rgb(153, 153, 136);" +
"rgb(136, 136, 136);" +
"rgb(102, 102, 102);" +
"rgb(187, 187, 187)".split(";");
$5(":visible")
.cssIsNot("color", allow, fiveui.color.colorToHex)
.each(function (i, elt) {
var color = fiveui.color.colorToHex($(elt).css("color"));
report("foreground color: " + color, elt);
});
}
]
}
|