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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{ 'name': "Colors are in a specified set"
, 'description': "All background and foreground colors used on a page should be in a specificed set"
, 'rules': [
{ 'image-appears': "Foregrounds"
, 'description': "Foreground colors are in a specified set"
, 'rule':
function() { //----------------------------------------------
var allowableColors = { '#0': 1, '#FFFFFF': 1, '#3D3D3D': 1,
'#B4B4B4': 1, '#4E4E4E': 1, '#C2C2C2': 1,
'#F7F7F7': 1 };
fiveui.query(':visible').each(
function(i, elt) {
var color = $(elt).css('color');
// console.log('color: ' + color + ' --> ' + fiveui.colorToHex(color));
if (!(fiveui.colorToHex(color) in allowableColors)) {
report('Disallowed FOREground color appears');
}
});
} //---------------------------------------------------------
},//==============================================================
{ 'image-appears': "Backgrounds"
, 'description': "Backgrounds colors are in a specified set"
, 'rule':
function() { //----------------------------------------------
var allowableColors = { '#0': 1, '#FFFFFF': 1,
'#3D3D3D': 1, '#B4B4B4': 1, '#4E4E4E': 1,
'#C2C2C2': 1 };
fiveui.query(':visible').each(
function(i, elt) {
var color = $(elt).css('background-color');
if (!(fiveui.colorToHex(color) in allowableColors)) {
report('Disallowed BACKground color appears');
}
});
} //---------------------------------------------------------
},//==============================================================
{ 'image-appears': "Content Area Color"
, 'description': "Content Area Color is #F7"
, 'rule':
//----------
function() {
var allowableColors = { '#F7F7F7': 1 };
fiveui.query("div[id='content'").each(
function(i, elt) {
var color = $(elt).css('color');
if (!(fiveui.colorToHex(color) in allowableColors)) {
report('Invalid color in content area');
}
});
} //---------------------------------------------------------
} //==============================================================
]
}
|